[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: counting with position()
I think I'm missing something in your question, because my first reaction is that <xsl:template match="level2/product"> <xsl:message>I am product #<xsl:number/> in this level (2)</xsl:message> </xsl:template> will do exactly what you ask: > How do I count all the product elements and display until the last one? Although I'm interpreting "until the last" to be inclusive. If you want to exclude the last, you could use <xsl:template match="level2/product"> <xsl:variable name="myPos" select="count(preceding-sibling::product) +1"/> <xsl:if test="count( ../product ) > $myPos"> <xsl:message>I am product #<xsl:number/> in this level (2)</xsl:message> </xsl:if> </xsl:template> Although I suspect there are better ways to do that.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|