Feature #3809
closedSerialization options ignored for XQuery update when using put
100%
Description
We have an Oxygen user reporting this issue against Saxon 9.8.0.8 from within Oxygen v20.0.
When using put, serialization options seem to be ignored. I can also reproduce this in the command line with 9.8.0.11 and within Oxygen v20.1 with 9.8.0.12.
test.xquery
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 "indent=yes";
declare option saxon:output "saxon:indent-spaces=4";
declare option output:method "xml";
declare option output:version "1.0";
declare option output:indent "yes";
let $xml :=
<root>
{
(: generates a child element hierarchy here :)
<test>
<a>text
</a>
</test>
}
</root>
(:return ($xml):)
return (
put( $xml, "MyFile.xml"))
In the command line I am running:
java -cp saxon9ee.jar net.sf.saxon.Query -t -backup:off -update:on -q:test.xquery
Result in MyFile.xml is:
<?xml version="1.0" encoding="UTF-8"?><root><test><a>text
</a></test></root>
Expected result is:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>
<a>text
</a>
</test>
</root>
PS: Could be related to https://saxonica.plan.io/issues/3708
Updated by Michael Kay almost 6 years ago
I don't think there's anything in the spec that says serialization properties defined using "declare option" should affect the fn:put() function. And there's no attempt in the code to use them. (Serialization properties first appeared in XQuery 3.0, and the XQuery Update spec was never upgraded to work with XQuery 3.0). I can see why you think it might be a good idea, but I don't think the implementation is non-conformant or buggy as it stands.
fn:put() uses serialization parameters defined in the Configuration, which you can set in a configuration file, or by calling
config.getDefaultSerializationProperties().setProperty("indent", "yes")
Updated by Michael Kay almost 6 years ago
- Tracker changed from Bug to Feature
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
- Applies to branch deleted (
9.8) - Fix Committed on Branch trunk added
I decided to implement this as a change in specification for the next major release.
I don't think a patch to the 9.8 behaviour would be appropriate; the current behaviour doesn't conflict with any W3C or Saxonica documentation, and could affect existing applications.
Updated by O'Neil Delpratt over 5 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.0.1 added
Bug fix applied in the Saxon 9.9.0.1 major release.
Please register to edit this issue