[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Printing all child bachelor nodes

Subject: RE: Printing all child bachelor nodes
From: cknell@xxxxxxxxxx
Date: Thu, 09 Feb 2006 10:43:46 -0500
xsl all child
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="text" indent="yes" />
 <xsl:strip-space elements="*" />

 <xsl:template match="/">
   <xsl:apply-templates />

 <xsl:template match="features">
   <xsl:apply-templates />

 <xsl:template match="*[not(local-name()='features')]">
<xsl:value-of select="local-name()" />
<xsl:when test="count(@*) = 0"><xsl:text>&#010;</xsl:text></xsl:when>
 <xsl:apply-templates select="@*" />

 <xsl:template match="@*">
<xsl:value-of select="local-name()" /><xsl:text>:</xsl:text><xsl:value-of select="." />
<xsl:if test="not(position() = last())"><xsl:text>&#009;</xsl:text></xsl:if>
<xsl:if test="position() = last()"><xsl:text>&#010;</xsl:text></xsl:if>

Charles Knell
cknell@xxxxxxxxxx - email

-----Original Message-----
From:     Douglas F Shearer <dougal.s@xxxxxxxxx>
Sent:     Thu, 9 Feb 2006 15:08:59 +0000
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   Printing all child bachelor nodes

Hi there.

I have the following snippet of XML and would like to extract the data given below using XSL...

********** XML ************
	<pool length="30" max-depth="160" min-depth="30" indoor="false"/>
	<beds twin="2" sofa-bed="1"/>

******** REQUIRED OUTPUT ******
pool: length: 30, max-depth:160, min-depth:30, indoor: false.
beds: twin:2, sofa-bed:1


The main issue I am having is that the nodes themselves change (microwave instead of DVD etc). Basically I want to print out all of the elements within the features element, and their associated attributes.

Help much appreciated.


Douglas F Shearer

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.