xsl-list
[Top] [All Lists]

[xsl] build a counter variable

2012-01-06 02:54:27
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> 
 
 
 
Thanks for any help

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--