This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: counting loop in xslt
- From: Antonio Fiol <fiol at w3ping dot com>
- To: xsl-list at lists dot mulberrytech dot com, "Pfitzner, Jan"<Jan dot Pfitzner at hdi dot de>
- Date: Tue, 28 May 2002 10:33:22 +0200
- Subject: Re: [xsl] counting loop in xslt
- References: <36885FC2A38EEA4098A91C29117F00370972AD@Z1IN054H.hdi.de>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Pfitzner, Jan wrote:
>for (int a; a <= number;;a++){}
>
>
Hello,
Once a variable is defined, you cannot change its value. However, you
can use recursive template calls like (not tested, may well not work):
<xsl:variable name="number">10</xsl:variable>
<xsl:template name="loop">
<xsl:param name="a" select="0" />
<!-- Use your a -->
<xsl:value-of select="$a">
<!-- Test condition and call template if less than number -->
<xsl:if test="$a < $number">
<xsl:call-template name="loop">
<xsl:with-param name="a" value="{$a + 1}" />
</xsl:call-template>
</xsl:if>
</xsl:template>
I insist, this has not been tested.
Antonio
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list