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 29209 - [xslt30] Template rules within xsl:override
Summary: [xslt30] Template rules within xsl:override
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
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: 2015-10-19 09:14 UTC by Michael Kay
Modified: 2015-10-28 17:17 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2015-10-19 09:14:59 UTC
The last paragraph in 6.1 is clearly wrong:

If the parent of the xsl:template element is an xsl:override element, then there must be a name attribute and no match attribute, and the package that is the target of the containing xsl:use-package element must contain among its components a named template whose symbolic identifier is the same as this named template, and which has a compatible signature.

because it does not allow adding template rules to a mode accepted from the used package.

I think it should read:

If the parent of the xsl:template element is an xsl:override element, then one of the following conditions must be true:

1. there must be a name attribute and no match attribute, and the package identified by the containing xsl:use-package element must contain among its components a named template whose symbolic identifier is the same as this named template, and which has a compatible signature.

2. there is a match attribute and a mode attribute, and no name attribute; the mode attribute must contain a single token which is the name of a mode that is exposed, with visibility equal to *public*, by the package identified by the containing xsl:use-package element.
Comment 1 Abel Braaksma 2015-10-19 12:30:17 UTC
We might add that the token #unnamed is never accessible here. Should we allow #all as a token? Why would we require a single token, is it for simplicity?
Comment 2 Michael Kay 2015-10-19 17:23:34 UTC
I was under the impression it was already restricted to a single explicitly named mode, but I may have been mistaken.

The #unnamed mode is never public, so it is automatically excluded.

I think we should exclude #all because it's very unclear what it is supposed to mean in this context.

But a list of explicitly named modes works, I think. Also, I found text under xsl:override that permits a template with both a name and a match pattern. So change the proposed text to:

If the parent of the xsl:template element is an xsl:override element, then one or both of the following conditions must be true:

1. there is a name attribute, and the package identified by the containing xsl:use-package element contains among its components a named template whose symbolic identifier is the same as this named template, and which has a compatible signature.

2. there is a match attribute and a mode attribute, and the mode attribute contains a list of tokens each of which is the name of a mode that is exposed, with visibility equal to *public*, by the package identified by the containing xsl:use-package element.

Note: #unnamed is not allowed because the unnamed mode never has public visibility. The token #all is not allowed because its intended meaning is not obvious.
Comment 3 Michael Kay 2015-10-22 10:53:19 UTC
Condition 2 above fails to allow for default-mode. So the proposed text becomes:

If the parent of the xsl:template element is an xsl:override element, then one or both of the following conditions must be true:

1. there is a name attribute, and the package identified by the containing xsl:use-package element contains among its components a named template whose symbolic identifier is the same as this named template, and which has a compatible signature.

2. there is a match attribute, and one of the following conditions is true:

2a. There is a mode attribute that contains a list of tokens each of which is the name of a mode that is exposed, with visibility equal to *public*, by the package identified by the containing xsl:use-package element.

2b. There is an ancestor-or-self element having a default-mode attribute whose value is the name of a mode that is exposed, with visibility equal to *public*, by the package identified by the containing xsl:use-package element.

Note: #unnamed is not allowed because the unnamed mode never has public visibility. The token #all is not allowed because its intended meaning is not obvious.
Comment 4 Michael Kay 2015-10-22 20:08:33 UTC
The changes were accepted and have been applied. A further refinement was noted: the mode attribute of an xsl:template element within xsl:override can contain the token #default provided the default mode is a public mode exposed by the used package.