[xquery-talk] following-sibling and preceding-sibling

Michael Kay mhk at mhk.me.uk
Thu Jul 10 12:48:27 PDT 2003


> what is the logic/rational 
> behind the apparent restriction of left/right navigation? Is 
> there some other means of accomplishing this that I'm not aware of?

The XQuery WG has had this debate a number of times, and although there
are many people who would like to offer the full set of axes, we haven't
(so far) been able to sway the argument. But in the next draft, XQuery
processors will be *allowed* to offer all the axes, though not
"*required* to do so. So we-re making progress...

I find it difficult to state the arguments against offering all the
axes, since I find them unconvincing. The most common argument is that
it's difficult to optimize them - but then, it's even harder to optimize
the workaround that the user is forced to write if the axes aren't
available. Another argument is that they aren't needed - this seems to
come from people who have only ever encountered neat tabular XML that
maps directly to relational structures.

There is a simple workaround for following-sibling::x, you can write 

let $current := .
return ../child::x[. >> $current]

and similarly for preceding-sibling.

Michael Kay



More information about the talk mailing list