[xquery-talk] XQuery and id()/idref(); Controlling the children of nodes in the result sequence

Florent Georges lists at fgeorges.org
Thu Apr 24 11:43:40 PDT 2008


Andrew Welch wrote:

  Hi

> if you rewrote

> not(ancestor::* intersect $e)

> to be

> not(some $x in ancestor::* satisfies $x is $e)

  That's not the same thing because 'is' compares two nodes.  So your
second expression would be rather equivalent to:

    not(ancestor::* intersect exactly-one($e))

  I'd say you should write instead:

    not(
      some $x in ancestor::* satisfies
        some $y in $e satisfies
          $x is $y
    )

  I didn't test them, but I guess even a naive processor would have
enough info in the second case to know it can stop as soon as it finds
a node that satisfies the identity (because of 'some').

  For the first case Saxon seems to wrap the intersection into an
'exists' instead of 'not', and I am confident that in this case it
stops when it finds a node.  But Mike can tell you more on that.

  But when I see the two expressions, my first reaction is to prefer to
trust my processor's optimizer and make the intent as clear as possible
for other developers...

  Regards,

--drkm



















__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail 



More information about the talk mailing list