Formatting XQuery Update output?
Issues related to W3C XQuery.
-
- Posts: 4
- Joined: Thu Nov 16, 2006 9:47 pm
Formatting XQuery Update output?
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
......Andrzej
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Formatting XQuery Update output?
Hi,
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 9.8.0.11 from what I tested.
Regards,
Adrian
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 9.8.0.11 from what I tested.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Formatting XQuery Update output?
Hi,
I've logged an issue at Saxonica: https://saxonica.plan.io/issues/3809
and Michael Kay has already responded there.
So, it seems XQuery Update is still at 1.0, for which there were no serialization properties (first appeared in XQuery 3.0).
There is a W3C working group note from January 2017 regarding XQuery Update Facility 3.0 which does mention a third parameter for fn:put for serialization parameters. However, there may be a while before this becomes a recommendation, or at least a draft, so there are no implementations yet.
Michael proposed as workaround to use the serialization parameters defined in the Saxon configuration. For Oxygen this translates into the following Saxon configuration file: Save this to a file (e.g. xqueryUpdateIndentSaxonConfig.xml)
In Oxygen edit the transformation scenario you use to run the XQuery, press the Advanced options (cogwheel button next to the Transformer combo box), check the box "Use a configuration file" and browse for the Saxon configuration file (xqueryUpdateIndentSaxonConfig.xml).
Regards,
Adrian
I've logged an issue at Saxonica: https://saxonica.plan.io/issues/3809
and Michael Kay has already responded there.
So, it seems XQuery Update is still at 1.0, for which there were no serialization properties (first appeared in XQuery 3.0).
There is a W3C working group note from January 2017 regarding XQuery Update Facility 3.0 which does mention a third parameter for fn:put for serialization parameters. However, there may be a while before this becomes a recommendation, or at least a draft, so there are no implementations yet.
Michael proposed as workaround to use the serialization parameters defined in the Saxon configuration. For Oxygen this translates into the following Saxon configuration file:
Code: Select all
<configuration edition="EE" xmlns="http://saxon.sf.net/ns/configuration">
<xquery allowUpdate="true"/>
<serialization indent="yes"/>
</configuration>
In Oxygen edit the transformation scenario you use to run the XQuery, press the Advanced options (cogwheel button next to the Transformer combo box), check the box "Use a configuration file" and browse for the Saxon configuration file (xqueryUpdateIndentSaxonConfig.xml).
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service