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

Re: for loop

Subject: Re: for loop
From: Gavin Corfield <gavin@xxxxxxxxxxxxxxxxxx>
Date: 18 Oct 2001 09:32:32 +0800
Re:  for loop
On Thu, 2001-10-18 at 01:58, Clark, Jason wrote:
> Hello All,
> 
> I have one node that holds a value of say 5 (this number could be any number
> 1-5 ).  I need to take that value and create 5 links that point to different
> locations.  Since the for-each is only a iterator across node sets, how
> would I handle this.

use a recursive template:

<xsl:template name="loop">
	<xsl:param name="index" />
.................
.................
	<xsl:if test="$index $gt; 0">
    	<xsl:call-template name="loop">
    		<xsl:with-param name="index" select="$index - 1"/>
    	</xsl:call-template>
	</xsl:if>
</xsl:template>

Just insert the code you want where the dots are and on the initial call
set the value of index appropriately

gavin
  



 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.