xsl-list
[Top] [All Lists]

Re: [xsl] Recursive for loop & xslt 2.0

2009-06-18 05:37:33
Thanks for your answers.
Can you please send me an example of how to write this hello world
loop with the
xsl:for-each select=" 1 to 10"?

Thanks

On Wed, Jun 17, 2009 at 3:13 PM, David 
Carlisle<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


    <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.
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--