w3c / qtspecs

XSLT and XQuery Specifications - the source used to build the specs, and the errata
Other
30 stars 27 forks source link

[xslt30] xsl:map and temporary output state #37

Open michaelhkay opened 2 years ago

michaelhkay commented 2 years ago

In §25.2, xsl:map and xsl:map-entry are not listed among the instructions that set temporary output state. I think this is an error; the immediately-preceding definition of temporary output states the intent "This state applies when instructions are writing to a temporary tree or any other non-final destination.", and a map is clearly a non-final destination.

michaelhkay commented 2 years ago

I've had second thoughts on this. A transformation that delivers a map as its final output is really much the same as a transformation that delivers an XML tree as its final output; it wouldn't be right to ban use of xsl:result-document in such a transformation. We want to allow xsl:result-document the issue that led to the problem was disable-output-escaping when creating a text node in an entry in the map. The user really wanted a string in the map, not a text node, but they used xsl:value-of (and disable-output-escaping) through ignorance.

§26.2 of the XSLT 3.0 spec doesn't say what happens if you disable-output-escaping for a text node that's added to a map and then serialised using the JSON output method.

For that matter, XSLT 3.0 doesn't define the default value of the serialization parameter json-note-output-method. (I would suggest choosing it the same way as the default value of method.)

I'm inclined to add a rule that disable-output-escaping is ignored for text nodes within maps.