Re: [xsl] Re: XSL-List Digest V3 #713

Subject: Re: [xsl] Re: XSL-List Digest V3 #713
From: VZAKON@xxxxxxxxxxxxx
Date: Wed, 25 Apr 2001 09:31:00 -0400
This XSL...

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:template match="/">
		<html>
		<xsl:call-template name="loop">
			<xsl:with-param name="until" select="5"/>
		</xsl:call-template>
		</html>
	</xsl:template>

	<xsl:template name="loop">
		<xsl:param name="until"/>
		<xsl:param name="x">0</xsl:param>
		<xsl:if test="$x &lt; $until">
			<!-- do something with $x -->
			<xsl:value-of select = "$x"/><br/>

			<!-- increment x -->
			<xsl:call-template name="loop">
				<xsl:with-param name="until" select = "number($until)"/>
				<xsl:with-param name="x" select = "number($x)+1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

... will "transform" any xml into:

<html>0</br>1</br>2</br>3</br>4</br></html>

Vladimir

>Date:Tuesday, 24 April 2001 1:06pm ET
>To:xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>From:sameulhe@xxxxxxx
>Subject: Re: [xsl] Re: XSL-List Digest V3 #713
>
>
>Banesh
>
>I think it is a little difficulty for xslt to do this,because in xslt,the
value
> of varialbe can not be reset.
>
>ÔÚ 2001-04-24 18:06:00 ÄúдµÀ£º
>>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
>
>Best regard
>            HeHangjun
>            sameulhe@xxxxxxx
>			hehangjun@xxxxxxxx
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>

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


Current Thread