Re: [xsl] build a counter variable

Subject: Re: [xsl] build a counter variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 06 Jan 2012 09:17:03 +0000
On 06/01/2012 08:54, henry human wrote:

Please start a new thread for new questions, don't reply to a previous one (even if you change the subject) This is in the
"[xsl] including an XSLT 1.0 stylesheet in a XSLT 2.0 one"
thread.



Hi

I have an XSLT structure as bellow. I tried to build a counter with the position () function .But it does not work because the position () function ever begins with  1 in a loop.
(In node1, node2, node3 the position begins with 1 (position= 1))


<xsl:for-each select="node1/m"> <m><xsl:value-of select="position()"/> </m> <== position should be 1 ....... <xsl:for-each select="node1/node2/a"> <a>....</a> <== position = 2 <a>....</a> <== position = 3 <a>.....</a> <== position = 4 </xsl:for-each>

<xsl:for-each select="node1/node3/f1">

  <f1><xsl:value-of select="position()"/></f1>                                    <== position = 5
</xsl:for-each>

</xsl:for-each>



It's not clear exactly what output you want, but perhaps


<xsl:number level="any"/>

is your friend.



Thanks for any help


David



--
google plus: https:/profiles.google.com/d.p.carlisle

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread