<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>30401</bug_id>
          
          <creation_ts>2019-02-23 02:48:32 +0000</creation_ts>
          <short_desc>[XSLT30] xsl:initial-template must be public, we don&apos;t say this, and examples in the spec and tests are wrong</short_desc>
          <delta_ts>2019-03-12 15:57:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.online</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>129553</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2019-02-23 02:48:32 +0000</bug_when>
    <thetext>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 &quot;Example: Named Component References in Inline Functions&quot; a package fragment with xsl:initial-template that has no visibility attribute and is therefore private.

(there&apos;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&apos;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: &quot;if the invocation ... *specifies* a template name&quot;. You could read that as if you *don&apos;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&apos;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 &lt;xsl:template&gt; there a visibility attribute</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129554</commentid>
    <comment_count>1</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2019-02-23 02:52:36 +0000</bug_when>
    <thetext>Related: Bug #30398</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129635</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2019-03-12 15:57:46 +0000</bug_when>
    <thetext>(In reply to Abel Braaksma from comment #0)
&gt; * Tests need to be fixed (I&apos;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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>