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 30401 - [XSLT30] xsl:initial-template must be public, we don't say this, and examples in the spec and tests are wrong
Summary: [XSLT30] xsl:initial-template must be public, we don't say this, and examples...
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: 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: 2019-02-23 02:48 UTC by Abel Braaksma
Modified: 2019-03-12 15:57 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2019-02-23 02:48:32 UTC
There are a few issues here:

1) In quite a few tests we use an xsl:package with xsl:initial-template (to name a few, most package-version-xxx).

2) In the spec we have under 3.5.3.5 (reference binding), under "Example: Named Component References in Inline Functions" a package fragment with xsl:initial-template that has no visibility attribute and is therefore private.

(there's one other occurrence in a spec-example, but there it appears under xsl:stylesheet, which will default to public).

3) Under 2.3.4 Call-Template Invocation we say that the default for call-template invocation is xsl:initial-template, further in that section we define:

[ERR XTDE0040] It is a dynamic error if the invocation of the stylesheet specifies a template name that does not match the expanded QName of a named template defined in the stylesheet, whose visibility is public or final. 

----

I vaguely remember we did this on purpose, the reason being that if a library package defines an xsl:initial-template, you don't want that accidentally taking over your starting point, so having it defaulting to private seems reasonable.

However, the text is also open to interpretation, the error says: "if the invocation ... *specifies* a template name". You could read that as if you *don't* specify it, the error does not apply (resulting in the default xsl:initial-template to be called regardless of its visibility). But this conflicts with the very reason of this error: it should also be raised if that template does not exist.

To sum up:

* I think xsl:initial-template ought to have visibility public or final

* It seems sensible to allow this to be implicitly true for the any such template in the top-level package, but this may be considered a new feature, which we cannot do at this stage

* Tests need to be fixed (I've fixed most locally)

For changes to the spec I suggest we choose one of these:

* If we cannot change the default (that xsl:initial-template is always valid if it exists with any visibility), then we should add a Note to clarify this

* We should fix the example in the spec to give the <xsl:template> there a visibility attribute
Comment 1 Abel Braaksma 2019-02-23 02:52:36 UTC
Related: Bug #30398
Comment 2 Abel Braaksma 2019-03-12 15:57:46 UTC
(In reply to Abel Braaksma from comment #0)
> * Tests need to be fixed (I've fixed most locally)
As can be seen in the referenced bug #30398 most such tests have been fixed and logged under that bug.

Leaving this issue open for discussion, and for fixing the relative parts of the spec.