In order to learn XQuery I tried to run the following XQuery command in BaseX
let $x := doc("test.xq")//h2/following-sibling return $x::h2
I supposed it should be equivalent to
let $x := doc("test.xq")//h2/following-sibling::h2 return $x
But it gives the following error and doesn't work while the second command works
Error:
Stopped at D:/Program Files/BaseX/data/test.xq, 1/66:
[XPST0003] Unexpected end of query: '::h2'.
In general, how can I select some nodes (h2
) in the context provided by a variable ($x := doc("test.xq")//h2/following-sibling
)