|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] XQuery and id()/idref(); Controlling the children of nodes in the result sequenceMichael Kay mike at saxonica.comWed Apr 23 19:53:01 PDT 2008
> > So if I am right, you want to not include an element if one > of its ancestors is included too? If you want so, use the > following instead of the for: > > let $e := $d/a:collection/a:entry/a:data > // *[@a:span = $s/@xml:id] > return > $e[not(ancestor::* = $e)] > That's not quite right, because the "=" tests for equality rather than identity. You could do let $e := $d/a:collection/a:entry/a:data //*[@a:span = $s/@xml:id] return $e[not(ancestor::* intersect $e)] or you could do a recursive function which stops searching any deeper when it finds a match: declare function local:s($e as element(), $id as xs:string) as element()* { $e/(if (@a:span eq $id) then . else */local:s(., $id)) } Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






