Re: [xsl] Recursive for loop & xslt 2.0

Subject: Re: [xsl] Recursive for loop & xslt 2.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 17 Jun 2009 13:13:11 +0100
     <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