This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: increment loop, was: Re: XSL-List Digest V3 #713
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: increment loop, was:[xsl] Re: XSL-List Digest V3 #713
- From: Ronald <ronald at salience dot nl>
- Date: Tue, 24 Apr 2001 12:58:14 +0100
- References: <200104240630.CAA19899@biglist.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
For this is a Frequently Asked Question I would think this one also can be
found in the FAQ list.
Anyway just to get you started, I included some code.
Hope this helps.
Ronald
ps. Install XML cooktop, for they have included a lot of code bits,
including the one I'm sending you now.
<!-- Use: include this call with the number of iterations
This sample will loop from 1 to 10 including 1 and 10
-->
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count">10</xsl:with-param>
</xsl:call-template>
<!-- Rename "old name" elements to "new name" -->
<xsl:template name="for.loop">
<xsl:param name="i"/>
<xsl:param name="count"/>
<xsl:if test="$i <= $count">
<!-- body of the loop goes here -->
</xsl:if>
<xsl:if test="$i <= $count">
<xsl:call-template name="for.loop">
<xsl:with-param name="i">
<!-- Increment index-->
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
At 06:06 PM 4/24/01 +0800, you wrote:
>Hello,
>
>Can anybody help me to solve this. I am using a for loop to display some
>information. In that loop i want increment the value of a variable i.e.,
>x=x+1. How to do this in xsl.
>
>Advance thanks
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list