I have a requirement where i need to return the full document at last after all the process completes.
My Last statement is having an xdmp:node-replace() and hence it is returning an empty sequence.
The nodes are getting replaced in my final document but i am not able to see them on console in 1st run. When i am running it second time then i can able to see the replaced node.
Here is the sample code-
abc.xml--->
<root>
<id>abcd</id>
</root>
let $doc := doc("abc.xml")
(: Let $doc is having an Id node :)
let $replace := xdmp:node-replace($doc//id,<id>1234</id>)
return $doc
Actual Output-->
<root>
<id>abcd</id>
</root>
Expected Output-->
<root>
<id>1234</id>
</root>
If i will return $replace then it will give me empty sequence
I want to return the expected output in 1st run
Any Suggestions ?