This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Testing by counting or positional predicate
- To: Kay Michael <Michael dot Kay at icl dot com>
- Subject: Re: [xsl] Testing by counting or positional predicate
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 11 Jan 2001 13:35:36 +0000
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <9008AF5250E3D411AE57009027CA88E30FCE9D@WWMESSD048>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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