Formatting XQuery Update output?

Issues related to W3C XQuery.
Posts: 4

Formatting XQuery Update output?

Wed Apr 25, 2018 7:23 pm


I'm using the latest Oxygen 20.0 release, latest Saxon EE 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="";
declare namespace output="";

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:method value="xml"/>
        <output:version value="1.0"/>
        <output:indent value="yes"/>

let $xml :=
        (: generates a child element hierarchy here :)
return (
    put( $xml, "../data/xml/MyFile.xml" )

Neither the saxon nor the standard options are taking hold and the output is not indented. Changing the put() function to be:

Code: Select all

put( $xml, "../data/xml/MyFile.xml",  $OUTPUT-OPTIONS )

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?


Posts: 2426

Re: Formatting XQuery Update output?

Thu Apr 26, 2018 6:29 pm


The problem seems to be within Saxon 9.8. I found this bug logged:
Serialization options ignored for XQuery update from command line
However, this doesn't seem to work in 9.7 or from what I tested.

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
Posts: 4

Re: Formatting XQuery Update output?

Wed May 02, 2018 9:38 pm

The logged bug said it was fixed in, but latest Oxygen is using

You guys gonna speak to Michael about this perhaps?

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests