Re: [xsl] Problems incrementing a variable in a <xsl:for-each>

Subject: Re: [xsl] Problems incrementing a variable in a <xsl:for-each>
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 23 Oct 2002 15:33:49 +0100
> I'm having problems incrementing a variable in a <xsl:for-each> section.

You can not change the value of a variable once it is bound.

don't do this:

>   <xsl:variable name="counter" select="1 + $counter"/>
>     <xsl:value-of select="$counter"/>


do this:


 <xsl:value-of select="position()"/>


> Output in TXT file

which xslt engine are you using? You should have no output at all, you
are supposed to get an error message at the point you attempt to
redefine your variable. 

David



_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread