[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: loop?

Subject: RE: loop?
From: "John Power" <john.power@xxxxxxxxxxxx>
Date: Mon, 27 Nov 2000 10:41:09 -0000
xsl loop incremental
Laurent,
When you want to loop, make a template like this:

<xsl:template name="loopNumber">
	<xsl:param name="inc" select="0"/>
	<xsl:param name="maxValue" select="10"/>
	<xsl:if test="$inc &lt; $maxValue">
		...some processing instructions...
		<xsl:call-template name="loopNumber">
			<xsl:with-param name="inc" select="$inc + 1"/>
			<xsl:with-param name="maxValue" select="$maxValue"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

This mimics the usual incremental loops in other programming languages(eg
'for ($inc=0; $inc<maxValue; $inc++)...' etc). I used a value of "10" for
'$maxValue' but you can change the value when you are calling the template
by giving it a new value with 'xsl:with-param'. Eg, when calling
'loopNumber' in the template matching 'some_element':

<xsl:template match="some_element">
	<xsl:call-template name="loopNumber">
		<xsl:with-param name="maxValue" select="20"/>
	</xsl:call-template>
</xsl:template>

Hope that helps
John Power


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.