Formatting XQuery Update output?
Posted: Wed Apr 25, 2018 7:23 pm
Hi:
I'm using the latest Oxygen 20.0 release, latest Saxon EE 9.8.0.8 XQuery processor.
I'm using XQuery Update to write xml output to a file, using the put() function, but can't seem to find a way to have that output indented.
Here is roughly what my XQuery looks like:
Neither the saxon nor the standard options are taking hold and the output is not indented. Changing the put() function to be:
doesn't work, since there is no 3-parameter put() function (probably not implemented in Saxon yet).
Any thoughts on how to ensure that MyFile.xml ends up properly indented?
Thanks!
....A
I'm using the latest Oxygen 20.0 release, latest Saxon EE 9.8.0.8 XQuery processor.
I'm using XQuery Update to write xml output to a file, using the put() function, but can't seem to find a way to have that output indented.
Here is roughly what my XQuery looks like:
Code: Select all
xquery version "3.1";
declare namespace saxon="http://saxon.sf.net/";
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare option saxon:output "saxon:indent-spaces=4";
declare option output:method "xml";
declare option output:version "1.0";
declare option output:indent "yes";
declare variable $OUTPUT-OPTIONS :=
<output:serialization-parameters>
<output:method value="xml"/>
<output:version value="1.0"/>
<output:indent value="yes"/>
</output:serialization-parameters>;
let $xml :=
<root>
{
(: generates a child element hierarchy here :)
}
</root>
return (
put( $xml, "../data/xml/MyFile.xml" )
Code: Select all
put( $xml, "../data/xml/MyFile.xml", $OUTPUT-OPTIONS )
Any thoughts on how to ensure that MyFile.xml ends up properly indented?
Thanks!
....A