Re: [xsl] Wath is the opposite of the union operator?

Subject: Re: [xsl] Wath is the opposite of the union operator?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 Sep 2005 16:44:09 +0100
> I'm curious about what's going on behind the scenes (that is, in the 
> processor) that makes this expensive.

without having looked behind the scenes, on the face of it count(.|B) is
a very expensive operation (if "B" selects a large set of noders) as you
have to take the set union | which invloves removing duplicates etc,
then count the thing, which means that you need to fully evaluate all of
B.

All you actually need to know is is . in the set returned by B which you
can ask  in xpath 2 using the is operator (so it would be a lot more
efficient even if except wasn't added as a primitive.
With such a test you can stop and return true as soon as you have found
the current node, just as B[1] typically only causes a processor to
evaluate one node, even though the formal semantics of the expression
are that B is fully evaluated, sorted into document order, and then the
first item is taken.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread