A counter inside a for-each?

Subject: A counter inside a for-each?
From: Maria Manuel <Maria.Manuel@xxxxxxxxxxxx>
Date: Thu, 23 Mar 2000 16:52:38 -0000
I want to write a "/" only if it´s not  the first ocurrence of the Field.
So, I have to use a  counter (conta14). But when I display the XML, conta14
has everytime the initial value 0. It doesn't change it!
Do you know any solution to this?!?!
...
<xsl:variable name="conta14">0</xsl:variable>
...
<xsl:template match="/">
...
<xsl:for-each select="//Field[@No='606']/Subfield[@No='a']">
	<xsl:if test="$conta14!=0">
		<xsl:text> / </xsl:text>
	</xsl:if>
	<xsl:value-of select="."/>
	<xsl:value-of select="$conta14"/>
	<xsl:variable name="conta14" select="number('$conta14')+1"/>
</xsl:for-each>
...
</xsl:template>
...

Thanks!

Maria Manuel Rodrigues Teixeira
EFACEC Sistemas de Informação, SA
maria.manuel@xxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread