This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29940 - [FO31] fn:transform serialization parameters
Summary: [FO31] fn:transform serialization parameters
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-18 08:41 UTC by Tim Mills
Modified: 2016-12-16 19:55 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2016-10-18 08:41:23 UTC
The description of option serialization-parameters reads:

"Serialization parameters for the principal result document. Any values supplied here override values specified in an xsl:output declaration in the stylesheet. These values have no effect on the serialization of secondary result documents. Default is an empty map. Standard parameters such as method and indent are supplied as QNames in no namespace."

It's not clear whether the parameters replace or augment those specified in the XSLT.  e.g. if an xsl:output element specifies indent="yes" and an empty serialization parameters map is specified, does indent="yes" still hold?  How about character maps or cdata-section-elements?
Comment 1 Michael Kay 2016-10-18 09:43:56 UTC
The intent is that it should follow the same semantics as all the other mechanisms for overriding serialization parameters, e.g.

* multiple xsl:output declarations with different precedence

* parameter documents overriding xsl:output

* xsl:result-document overriding xsl:output

* API parameters overriding parameters within the stylesheet

These are all designed to work the same way:

- if a parameter is present then it overrides the underlying parameter, except for cdata-section-elements and suppress-indentation where it supplements it

- if a parameter is absent then the underlying value is unchanged

I guess it would be useful to have all these rules in one place and to be able to refer to them by name - but we can't do that for XSLT 1.0 and 2.0.
Comment 2 Michael Kay 2016-10-18 15:56:08 UTC
Agreed that it would be useful to have a slightly less terse explanation in the spec of how this is supposed to work.
Comment 3 Michael Kay 2016-10-19 08:46:56 UTC
Taking into account also bug #29943, I have replaced the entry for serialization-params in the fn:transform table with:

Serialization parameters for the principal result document. The supplied map follows the same rules that apply to a map supplied as the second argument of <code>fn:serialize</code>. When a parameter is not supplied (that is, when the key is absent or when the corresponding value is an empty sequence) the value used is the value specified in the unnamed <code>xsl:output</code> declaration, or its default. When a parameter is supplied, the corresponding value overrides or augments the value specified in the unnamed <code>xsl:output</code> declaration (or its default), following the same rules as when one <code>xsl:output</code> declaration overrides another with lower import precedence.
Comment 4 Michael Kay 2016-10-19 09:26:30 UTC
A slight refinement.

In the serialization parameters, map { "standalone": () } means that no standalone attribute should be written to the XML declaration. We need this setting to be able to override a stylesheet declaration like <xsl:output standalone="yes"/>.

Therefore, I think we should treat a parameter that is present with a value of () as an override of a value specified in xsl:output, rather than ignoring it as proposed in comment #3.

I'm leaving the bug open so that the resolution can be reviewed by the WG. The text now reads:

Serialization parameters for the principal result document. The supplied map follows the same rules that apply to a map supplied as the second argument of <code>fn:serialize</code>. When a parameter is supplied, the corresponding value overrides or augments the value specified in the unnamed <code>xsl:output</code> declaration (or its default), following the same rules as when one <code>xsl:output</code> declaration overrides another with lower import precedence.
When a parameter is supplied and the corresponding value is an empty sequence (for example, <code>map{"standalone":()}</code>, any value specified in the unnamed <code>xsl:output</code> declaration is overridden by the default value.  When a parameter is not supplied in <code>serialization-params</code> (that is, when the key is absent) the value that applies is the value appearing in the unnamed <code>xsl:output</code> declaration, or its default.
Comment 5 Michael Kay 2016-10-25 15:25:05 UTC
The proposal was accepted.
Comment 6 Michael Kay 2016-10-26 09:40:37 UTC
The changes have been applied to the spec.