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

RE: Iteration without nodes

Subject: RE: Iteration without nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 26 Jul 2006 17:04:53 +0100
RE:  Iteration without nodes
> I've successfully used the expression <xsl:for-each
> select="fieldcount[position() &lt; $lastNo]"> to perform a 
> certain operation a number of times.  I'm not sure where I 
> got it and can't find information on why it works.  Now I'm 
> doing a slightly different stylesheet and I can't get the 
> desired result.  Could someone explain how this operation works.

Colin has explained how it works.

In XSLT 2.0 you can do <xsl:for-each select="1 to $N">.

In XSLT 1.0 the purist solution is a recursive template to which you pass a
parameter N indicating the number of iterations required; it does the work
once, then if N>1 it calls itself, passing the value N-1 as the number of
iterations remaining. But the dirty hack of iterating over a
sufficiently-large node-set is often preferable, because you don't risk
running out of stack space.

Michael Kay
http://www.saxonica.com/

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.