[xquery-talk] some ... satisfies with positional variable

Michael Kay mhk at mhk.me.uk
Sat Aug 20 09:04:54 PDT 2005


> For example
> 
> let $x := doc("foo.xml")/bar return
>     if (some $y at $pos1 in $x/child::* satisfies(
>           (fn:node-name($y) == "tag0") and
>           (some $z at $pos2 in $x/child::* satisfies(
>              (fn:node-name($x) == "tag1") and ($pos1 > $pos2))))
>     then return $x else ()
> 

An XPath 1.0 user would be happy to write that as

document("foo.xml")/bar[tag1/following-sibling::tag0]

You're making life much more difficult than it needs to be.


Michael Kay
http://www.saxonica.com/




More information about the talk mailing list