Is there a way to output unescaped XML to a string for debugging purposes? In unittests we would like to output the XML returned when a test fails, here is my example:
declare %unit:test function elementinfo-test:test-element-info()
{
let $cases :=
<cases>
<case>
<comment>Failed input</comment>
<input>input</input>
<output>
<result> output </result>
</output>
</case>
</cases>
for $case in $cases/case
let $result := {some function which returns XML}
let $u := unit:assert(deep-equal($case/output, result),
$case/comment/text()
|| " Input: " || $case/input/text()
|| " Expected: " || fn:serialize($case/output)
|| " Got: " || fn:serialize($result))
return $u
};