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

RE: Ordering of Blocks based on Input/Output

Subject: RE: Ordering of Blocks based on Input/Output
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 9 May 2001 17:26:48 +0100
ordering node set xslt
> > >     <xsl:if test="count($todo) > 0">
> >
> > This test does the same as test="$todo", which is
> > much more efficient for larger data,
> > if the processor doesn't optimize it anyway.
> >
> Quite right about the equivalence, though I don't know if
> doing count()
> on a node-set held in a variable will take as long as it would if
> gathering the node-set for the first time.

Many XSLT processors will "gather the node-set for the first time" when
evaluating the count() function - delayed evaluation and pipelining is the
norm in a functional language. That's why test="$todo" (or
test="boolean($todo)" for clarity) is faster, because it can stop as soon as
it sees the first node.

Saxon rewrites "count($todo) > 0" as "boolean($todo)" at compile time,
provided it knows at compile time that $todo is a node-set - which will
generally be the case for a variable, but not for a parameter.

Mike Kay

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.