2
votes

I am using something like

let $x := 
 "<root>
 <parent1>value1</parent1>
 <parent2>value2</parent2>
 </root>"
...

and converting the XML document to string. I wanted to pass an xml output from a function to another function as a string and not by hard coding it as I'm doing it right now.

I tried using fn:string, but that doesn't pick up the xml tags as string.

1
You might want to think a little about why you are doing this. Normally you work with XML nodes as nodes, not strings. There are exceptions, but they aren't common. - mblakele

1 Answers

6
votes

I think you simply want the opposite of xdmp:unquote - which is called xdmp:quote

xquery version "1.0-ml";    
let $x := xdmp:quote(<root>
         <parent1>value1</parent1>
         <parent2>value2</parent2>
         </root>)

return $x