I’m not sure I follow. In your original post you wrote:
If you just want to get the root node you can do either:
for $i in input()/level1
where $i//@attrib=‘bb’
return $i
OR
for $i in input()/level1//@attrib
return root($i)
(The queries are a little different in that the second one will return the same document multiple times, if that document has multiple @attrib attributes)
In theory you could modify the second query to return both the root element and the modified element, but when I do that I get a runtime exception for some reason.
for $i in input()/level1//@attrib
return
{root($i)}
{$i/…}
However, both these queries return an XML tree, not an X-Path expression. If you really want an X-path expression I’m not sure how to get that.
Bill
#Tamino#API-Management#webMethods