On Sun, 2019-03-24 at 04:22 +0100, Andreas Mixich wrote: > let $xml as element() := <xml>Hello World</xml> > return serialize($xml, map{"method":"entity-escaped-string"} > > would result in > > <xml>Hello World</xml>
One way, declare function local:escapexml($input as item()*) as xs:string? { <wrapper>{fn:serialize($input)}</wrapper>/text() }; declare option output:method "xml"; local:escapexml( <boy> <name>Simon</name> <age>24 years</age> <socks>blue</socks> </boy> ) Note that if you don’t have the XML output method, strings are output without escaping, so you can’t see that it has worked. Liam -- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Web slave for vintage clipart http://www.fromoldbooks.org/