Depends on which XQuery processor you are using ... The easiest way is to use a processor that has an extension that handles this for you. For example, with Saxon and the following XML :
<a><c>asdf</c></a>
You can write XQuery that uses the saxon:parse() function to do what you want:
declare namespace saxon = "http://saxon.sf.net/"; <a>{ saxon:parse(doc('test.xml')/a) }</a>
Result:
<a> <c>asdf</c> </a>
I think most (?) XQuery processors will have an extension to do this for you. Hope this helps.
ksclarke
source share