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

Re: Recursive for loop & xslt 2.0

Subject: Re: Recursive for loop & xslt 2.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 17 Jun 2009 13:13:11 +0100
Re:  Recursive for loop & xslt 2.0
     <xsl:with-param name="i">1</xsl:with-param>

It's inefficient to do that for xslt 1 and wrong and inefficient in xslt2.


the above makes a document node (rtf in xslt 1) with a text node child with string value
"1"

whereas what you want is


  <xsl:with-param name="i" select="1"/>

which makes a number (in xslt1) or integer (xslt 2) 1.

In xslt 1 it's just inefficient as the result tree fragment has to be
coerced back to a number, but in xslt 2 it gets the wrong values as the
< operator on document nodes will do a lexical comparison of the string
values of the nodes, so "10" will be less than "2" unless you have a non
standard default collation.

of course in xslt 2 it's easier to doi

xsl:for-each select=" 1 to 10"


David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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.