This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re: XSL-List Digest V3 #713


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@lists.mulberrytech.com
>From:sameulhe@163.net
>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@163.net
>			hehangjun@sina.com
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]