previous  next

Full Axis Feature

XQuery makes some of the XPath axes optional, they will not work in some XQuery systems.

$y/preceding::*[2]/string(@i)

xq2xml provides an XQuery-to-XQuery transformation that replaces all references to optional axes by equivalent portable (but probably less efficient) expressions.

$y/
(let $here := . return
   reverse(root()/descendant::*[. << $here]
                               [not(descendant::node()[. is $here])]))
                               [2]/string(@i)