When the s9api Serializer object is used to define the destination of an XQuery or XSLT transformation, serialization properties set on the Serializer may not work as expected/intended.
The intention is that properties defined using the s9api API should override any properties defined within the stylesheet (using xsl:output) or query (using declare option saxon:output). If a property is not defined using s9api then the internally-defined property should be used; in the case of cdata-section-elements the two values are additive.
This is not working. What is actually happening is that for properties implemented directly within the final Emitter (such as omit-xml-declaration and byte-order-mark), only the value set from the query or stylesheet (or its default) has any effect. For properties that cause extra steps to be added to the serialization pipeline, such as indent, cdata-section-elements, or escape-uri-attributes, only the s9api value has any effect, even if the property is not explicitly set.
A patch will be placed in Subversion for the 9.1 branch. Although the problem also affects 9.0, it will not be fixed on that branch because the changes are potentially disruptive.
(One of the effects of the patch is that if setOutputProperties() is called twice on the same Emitter, the second call has no effect. This could potentially affect paths other than the s9api use case.)