Feature #3809

Serialization options ignored for XQuery update when using put

Added by Adrian Buza about 2 years ago. Updated almost 2 years ago.

XQuery Update
Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:


We have an Oxygen user reporting this issue against Saxon from within Oxygen v20.0.

When using put, serialization options seem to be ignored. I can also reproduce this in the command line with and within Oxygen v20.1 with


xquery version "3.1";

declare namespace saxon="";
declare namespace output="";

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 :=
        (: generates a child element hierarchy here :)
(: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

Expected result is:

<?xml version="1.0" encoding="UTF-8"?>

PS: Could be related to


#1 Updated by Michael Kay about 2 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")

#2 Updated by Michael Kay about 2 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.

#3 Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release added

Bug fix applied in the Saxon major release.

Please register to edit this issue

Also available in: Atom PDF