xsl-list
[Top] [All Lists]

Re: Wath is the opposite of the union operator?

2005-09-22 08:44:09
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
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--