Subject: RE: [xsl] Getting position while ignoring empty elements From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx> Date: Tue, 27 Apr 2004 14:34:16 +0100 |
> Is it possible to find the position of an element while ignoring all > elements containing no text. For example, given the following: > > <furniture> > <item>table</item> > <item/> > <item>chair</item> > </furniture> > > I would like to output: > > Furniture > 1. table > 2. chair Lots of ways, one being: <xsl:template match="furniture"> <xsl:for-each select="item[child::node()]"> <xsl:value-of select="position()"/>. <xsl:value-of select="."/> </xsl:for-each> </xsl:template> The for-each will iterate over each <item> node that has a child node (whitespace included). The function position() will return the position of the node within the set selected by the for-each. cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How to see the output of , Daniel Joshua | Thread | [xsl] tomcat web server and dynamic, Nikolas Nehmer |
AW: [xsl] tomcat web server and dyn, Nikolas Nehmer | Date | RE: [xsl] Multiple groupings, Kenny Akridge |
Month |