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

Re: For Loop in XSLT

Subject: Re: For Loop in XSLT
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 3 May 2002 12:12:46 +0100
sum loop xslt
Hi Ratul,

> I was just wondering if there is something like the for loop we have
> in other languages. I simulated it by recursively calling a template
> from itself. But I was not sure whether it is the only/best method.

It depends on what you want to loop over and what you want to do with
the loop. If you want to iterate over a set of nodes, and create part
of the result tree for each, you can use xsl:for-each or
xsl:apply-templates. Certain "aggregator" functions are built in, such
as sum() (to get the sum of a set of nodes) or count() (to count how
many nodes there are in a set). (There are more aggregator functions
in XPath 2.0.) Otherwise, you're right that you have to use a
recursive template.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.