<?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>29763</bug_id>
          
          <creation_ts>2016-07-31 14:09:47 +0000</creation_ts>
          <short_desc>[XSLT30] overriding xsl:param with xsl:variable or vice versa should be disallowed</short_desc>
          <delta_ts>2017-01-30 15:52:25 +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>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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.braaksma</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>maxtoroq</cc>
          
          <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>127091</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-07-31 14:09:47 +0000</bug_when>
    <thetext>We say in xsl:override that you can override when two components are homonymous. That term is defined with reference to *symbolic identifier*, which reads:

[Definition: The symbolic identifier of a component is a composite name used to identify the component uniquely within a package. The symbolic identifier comprises the kind of component (stylesheet function, named template, accumulator, attribute set, global variable, key, or mode), the expanded QName of the component (namespace URI plus local name), and in the case of stylesheet functions, the arity.]

We mention here &quot;global variable&quot;, which refers to both xsl:variable and xsl:param. But we also say &quot;the same kind of component&quot;, and I think that the component declared with xsl:param is different (not homonymous) from one defined with xsl:variable.

Max Toro reported this in Bug 29574, comment 18, claiming you can *convert* a variable into a parameter this way (or vv). I don&apos;t think this was an intended behavior and if the WG agrees, I would like this behavior to be an error scenario: an xsl:param cannot be overridden by an xsl:variable, or the other way around.

Note also that an xsl:param is implicitly public and has no @visibility. An xsl:variable has a visibility. I don&apos;t think we need the complexity of the interactions of these rather confusing/conflicting declarations if you try to override them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127094</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-07-31 21:18:04 +0000</bug_when>
    <thetext>Overriding a param with a variable is a very important use case because it&apos;s the only way an overriding stylesheet can &quot;fix&quot; the value for the parameter.

Overriding a variable with a param is also useful. If an overriding stylesheet can change the value of the variable, why shouldn&apos;t it be allowed to say &quot;I want the user to be able to set the value of this variable&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127097</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-08-01 09:09:25 +0000</bug_when>
    <thetext>The use case seems viable, indeed. But there was a reason that xsl:param was made implicitly public (to enforce it is always settable externally). Now by overriding it with xsl:variable it can be hidden. I&apos;m unsure whether we have properly understood the consequences of this. Maybe there&apos;s no problem and it should / could stay the way it is. I&apos;ll chew a bit more on this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127216</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-08-24 09:30:19 +0000</bug_when>
    <thetext>&gt; I&apos;ll chew a bit more on this.
I did the chewing :). 

We agreed that an xsl:variable can be overridden by an xsl:param and vv, provided the correct visibility and homonimity are present.

This seems to be supported by the specification by absence of a rule that the overriding declaration of xsl:param or xsl:variable must have a matching overriding declaration (instead, we speak of &quot;global variables&quot; in the general sense). This could be made explicit, but I don&apos;t think there&apos;s an error here.

Max Toro&apos;s comment in Bug 29574 refers to an (apparent) ambiguity in the spec: under 3.5.3.2. we explain that if you use a package with xsl:use-package, and there is *no* matching declaration inside xsl:override or xsl:accept, the default visibility of a public component becomes *private*.

In the case of xsl:param this is not possible, as it is implicitly public and it has no visibility attribute. To fix this, I propose to add a row in the table under 3.5.3.2 that there&apos;s an exception for xsl:param: the default visibility does *not* change from public to private, instead, it remains public.

This makes sense, because a global parameter is never private.

Under 3.5.3.3 we added this exception already (&quot;except in the case of xsl:param, which is implicitly public.&quot;).

Instead of adding a Note as suggested by Max Toro, I think a normative entry in the table (under 3.5.3.2) for the xsl:param exception makes more sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127227</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-08-25 09:26:46 +0000</bug_when>
    <thetext>I agree with comment #3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127263</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-01 15:14:59 +0000</bug_when>
    <thetext>The WG discussed this and resolved it with the action:

ACTION-2016-08-25-001: MKay to implement comment#3 of bug 29763 into the spec on fixing default visibility of xsl:param for used packages</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128427</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-01-30 15:05:49 +0000</bug_when>
    <thetext>It seems that this change was never applied to the spec.

I am doing so now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128428</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-01-30 15:52:25 +0000</bug_when>
    <thetext>The rules turned out to be a bit more complex than envisaged. The main change is to specify that xsl:accept and xsl:expose never match an xsl:param declaration, which means that (a) if an explicit name is used and the declaration is an xsl:param, then it&apos;s a static error, (b) if a wildcard is used, it doesn&apos;t apply to xsl:param declarations.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>