[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: For Loop in 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|