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 29827 - [XSLT 3.0] Error XTDE0045 revisited
Summary: [XSLT 3.0] Error XTDE0045 revisited
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: 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-09-19 14:15 UTC by Michael Kay
Modified: 2017-01-04 20:45 UTC (History)
2 users (show)

See Also:


Attachments
Tabular presentation of the proposed rules for XTDE0045 (25.20 KB, application/pdf)
2016-09-28 18:45 UTC, Michael Kay
Details

Description Michael Kay 2016-09-19 14:15:16 UTC
(see also bug #29234, bug #29379 and bug #29475)

I don't think we've got this right yet. Consider test case mode-1705a.

declared-modes="yes" requires a declaration of all the modes that are used; fine, the stylesheet contains such declarations.

But it's failing because we are using the unnamed mode as the entry point. The unnamed mode is not and cannot be public. But the way XTDE0045 is worded, invoking a stylesheet using the unnamed mode is impossible when declared-modes="yes". I don't believe that's what we intended, and it's not what the note underneath XTDE0045 says:

<note>Or to put it another way: (a) if a named initial mode is specified, then it must exist as a public mode in the top-level package, declared implicitly or explicitly; (b) if the unnamed initial mode is specified and declared-modes="yes", then there must be an xsl:mode declaration for the unnamed mode.</note>

Under condition (b), which I believe represents our intent, test cases mode-1705a is not an error.

See also 6.6.1, which says "A /named/ mode [my emphasis] is not eligible to be used as the initial mode if its visibility is private."

I think the correct rules are:

(a) if the initial mode is a named mode:

(a(i)) if declared-modes="yes":

The named mode must be declared and must have visibility="public" or "final".

(a(ii)) if declared-modes="no":

The named mode must either be declared with visibility="public", or must be implicitly declared in the top-level package by virtue of it's appearance in an xsl:template/@mode attribute

(b) if the initial mode is the unnamed mode:

(a(i)) if declared-modes="yes":

The unnamed mode must be declared.

(a(ii)) if declared-modes="no":

No constraints.

====

Without these changes, using declared-modes='yes' means that you can't invoke processing via the unnamed mode, and since that is how 95% of transformations are initiated today, everyone is going to set declared-modes='no' so they can continue working the way they are used to.
Comment 1 Michael Kay 2016-09-28 18:45:18 UTC
Created attachment 1656 [details]
Tabular presentation of the proposed rules for XTDE0045
Comment 2 Michael Kay 2016-10-06 17:20:28 UTC
To add another twist on this, there's been discussion on a Saxon forum here:

https://saxonica.plan.io/boards/3/topics/6565

The question here is whether the default mode can be private. I think it can; but since the default mode for the top-level module of the top-level package is also the default for the initial mode, it's not a good idea for that to be private. Unless you deliberately want to prevent apply-templates invocation, of course.
Comment 3 Michael Kay 2016-11-18 18:26:03 UTC
After long discussion in the WG, Abel proposed a resolution here

https://lists.w3.org/Archives/Public/public-xsl-wg/2016Nov/0006.html

and this was accepted in principle by the WG.

I have drafted the rules slightly differently, to depend on the value of declared-modes rather than on whether the stylesheet had an explicit xsl:package element (this is because I don't want to break the equivalence whereby a stylesheet rooted with xsl:stylesheet is transformed into one rooted with xsl:package). In the refactored rules, a mode M is eligible as the initial mode if any of the following conditions is true:

1. M is explicitly declared in an xsl:mode declaration, and is public or final;

2. M is the unnamed mode.

3. M is named in the default-mode attribute of the top-level module.

4. M  is declared in a used package and is accepted as public or final in the top-level package.

5 declared-modes='no" and M appears as a mode-name in the mode attribute of a template rule.

Leaving open for the WG to review the detailed text.
Comment 4 Abel Braaksma 2016-11-19 01:25:39 UTC
I think this works. Perhaps we should say on rule 5:

5. The effective value of the *declared-modes* attribute is "no" and M appears as a mode name in the mode attribute of a template rule.

(this is similar to the wording used for XTSE3085).

Editorially:

Note that the first item ends with ";" and the others with "." (in case you'd copy/paste them into the WD).

Note for consistency that the WD presently uses "mode name", not "mode-name".