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

RE: simple conditional looping

Subject: RE: simple conditional looping
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Mon, 16 Aug 2004 10:40:55 +0100
saxon xslt 2.0 looping
> Hi Keyur,
>   You can simulate a loop with recursion..
>
> <xsl:call-template name="iterate">
>   <xsl:with-param name="x" select="50" />
> </xsl:call-template>
>
> <xsl:template name="iterate">
>   <xsl:param name="x"/>
>
>   <xsl:if test="$x > 0">
>     <tr/>
>     <xsl:call-template name="iterate">
>       <xsl:with-param name="x" select="$x - 1" />
>     </xsl:call-template>
>   </xsl:if>
> </xsl:template>


Using xslt 2.0 you can use:

  <xsl:for-each select="for $x in 1 to 50 return $x">
    <xsl:value-of select="."/>
  </xsl:for-each>

Using Saxon you can easily use this with your xslt 1.0 stylesheets
(unless you are worried about portability).


Cheers
andrew

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.