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 24234 - Unclear resolution of default attributes for named modes and error XTSE0545
Summary: Unclear resolution of default attributes for named modes and error XTSE0545
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
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: 2014-01-08 12:44 UTC by Abel Braaksma
Modified: 2014-02-11 19:54 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2014-01-08 12:44:20 UTC
For an unnamed mode, we have the following attribute resolution defined:

"For the unnamed mode, the effective value of each attribute is taken from an xsl:mode declaration that has no name attribute, and that specifies an explicit value for the required attribute. If there is no such declaration, the default value of the attribute is used. [...]"

For a named mode, we have the following attribute resolution defined:

"For any named mode, the effective value of each attribute is taken from an xsl:mode declaration that has a matching name in its name attribute, and that specifies an explicit value for the required attribute. [...]"


The difference between the two definitions is that for a named mode, it is not clear how default values for the attributes are applied. I assume it is meant to work the same way as for the default mode. I propose to add the sentence "If there is no such declaration, the default value of the attribute is used." to the named mode attribute resolution rule.

This (slight) ambiguity also applies to XTSE0545, which is defined as follows:

"[ERR XTSE0545] It is a static error if a named or unnamed mode contains two conflicting values for the same attribute in different xsl:mode declarations having the same import precedence, unless there is another definition of the same attribute with higher import precedence. [...]"

This applies to, for instance, the following declarations:

<!-- throws XTSE0545??? -->
<xsl:mode streamable="yes" />
<xsl:mode on-no-match="deep-copy" />

It is my understanding, that if we apply the first attribute resolution rule above (the one for unnamed modes), that by extension, the previous snippet should throw XTSE0545, because the second declaration has an implicit default streamable="no", and both have the same import precedence.

The part being unclear in the error definition is the word "contains". Does it, or does it not, apply _only_ to explicit mode attributes?

My preference is clarity: implicit mode attributes also raise XTSE0545. This has the consequence that any non-default mode attribute defined under the same import precedence must be included in a redefinition for it to be valid.
Comment 1 Michael Kay 2014-01-13 20:52:55 UTC
On the first point, I agree. For named modes we should add the statement that the effective value is the default value if no value is specified.

One the second point, I think that conflicts should only be reported between explicit attribute values. That's what the spec currently says (it talks about the "values" of the attributes, not the "effective values"), and I think it's the right thing to say. It's consistent with other declarations that allow the attributes to be spread across multiple declarations (such as xsl:output and xsl:decimal-format). There's no point in allowing multiple declarations of a mode at the same import precedence if we require all information on one of the declarations to be exactly replicated in the others.
Comment 2 Abel Braaksma 2014-01-14 18:37:00 UTC
If I compare the text with the related one from xsl:output (error XTSE1560), then that error is clearer in its description: it says "if two xsl:output declarations within an output definition specify explicit values for the same attribute ".

It is this difference that is confusing. When for XTSE0545 we say "values", without specifying whether that's implicit or explicit, I checked comparable errors, where in the case of XTSE1560 the term "explicit values" is mentioned. This led me to deduct that xsl:mode behaved different than xsl:output in conflict resolution.

I suggest we simply change "values" into "explicit values" (for XTSE1560) to make this ambiguity go away.

Note: our current implementation mistook the meaning of the error, failing some tests, which ultimately led to this bug-report.
Comment 3 C. M. Sperberg-McQueen 2014-02-10 11:27:59 UTC
The WG discussed this during the ftf meeting in Prague and accepted
the proposal made in comment 1.
Comment 4 Michael Kay 2014-02-11 19:54:52 UTC
1. Added the sentence

If there is no such declaration, the default value of the attribute is used.

to the paragraph about named modes.


2. Error XTSE0545 now reads:

It is a static error if for any named or unnamed mode, a package explicitly specifies two conflicting values for the same attribute in different xsl:mode declarations having the same import precedence, unless there is another definition of the same attribute with higher import precedence....