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

Re: Testing by counting or positional predicate

Subject: Re: Testing by counting or positional predicate
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 11 Jan 2001 13:35:36 +0000
xsl test nodeset length
Hi Mike,

Thanks very much for your discussion.  I'll go back to the counting
method.

On the same kind of topic, there's the question of which of these is
more efficient:

  count($node-set) >= $length

or:

  $node-set[$length]

I guess that this will depend on when the node set is constructed: if
it's constructed in advance of the test, then the first is probably
better because it just tests two numbers as opposed to iterating over
the nodes, unless $length is very small in which case they're probably
roughly equivalent.

If the node set is constructed on the fly and it's relatively likely
that it's at least $length in length, then it's probably better to use
the second because it prevents having the whole node set constructed
before its length is tested.  If it's unlikely that the node set will
be of length $length, then they're probably roughly equivalent.

Would that be an accurate analysis?

Thanks,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


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.