<?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>25874</bug_id>
          
          <creation_ts>2014-05-23 11:56:10 +0000</creation_ts>
          <short_desc>[XT30TS] error-code-268</short_desc>
          <delta_ts>2014-06-10 13:02:12 +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 Test Suite</component>
          <version>2nd Edition Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>INVALID</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="Tim Mills">tim</reporter>
          <assigned_to name="Abel Braaksma">abel.online</assigned_to>
          <cc>mike</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>106702</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-05-23 11:56:10 +0000</bug_when>
    <thetext>This test uses a template wit a required parameter, whose value is not referenced.  Is it mandatory to raise an error in this case?

  &lt;xsl:template match=&quot;doc&quot;&gt;
    &lt;xsl:param name=&quot;x&quot; required=&quot;yes&quot;/&gt;
    &lt;xsl:value-of select=&quot;2&quot;/&gt;
  &lt;/xsl:template&gt;


[ERR XTDE0700] In other cases, it is a non-recoverable dynamic error if the template that is invoked declares a template parameter with required=&quot;yes&quot; and no value for this parameter is supplied by the calling instruction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106705</commentid>
    <comment_count>1</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-05-23 14:54:46 +0000</bug_when>
    <thetext>No, you do not need to reference the parameter. But you do need to pass the parameter on in xsl:apply-templates/xsl:with-param. If you don&apos;t, raise XTDE0700.

Whether or not the parameter is referenced in the body of the template is not relevant (according to the current state of the spec).

Do you want to raise a spec-bug for this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106706</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-05-23 15:16:48 +0000</bug_when>
    <thetext>I think you may have misunderstood me.

  &lt;xsl:template match=&quot;doc&quot;&gt;
    &lt;xsl:param name=&quot;x&quot; required=&quot;yes&quot;/&gt;
    &lt;xsl:value-of select=&quot;2&quot;/&gt;
  &lt;/xsl:template&gt;

does not reference $x.  Therefore $x need never be evaluated.  Therefore I can determine that this template either raises an error (XTDE0700), or returns 2.  I am therefore permitted to avoid raising the dynamic error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106709</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-05-23 15:37:11 +0000</bug_when>
    <thetext>I think as the error is currently defined you have to raise it unconditionally. I don&apos;t  think one can appeal to XPath errors and optimization rules for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106711</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-05-23 15:39:42 +0000</bug_when>
    <thetext>OK thanks.

Happy to close.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106712</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-05-23 15:44:33 +0000</bug_when>
    <thetext>I was happy, and then I read this.

&quot;Because different implementations may optimize execution of the stylesheet in different ways, the detection of dynamic errors is to some degree implementation-dependent. In cases where an implementation is able to produce the final result trees without evaluating a particular construct, the implementation is never required to evaluate that construct solely in order to determine whether doing so causes a dynamic error. For example, if a variable is declared but never referenced, an implementation may choose whether or not to evaluate the variable declaration, which means that if evaluating the variable declaration causes a dynamic error, some implementations will signal this error and others will not.&quot;

So I think raising the error here is not required.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106721</commentid>
    <comment_count>6</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-05-23 16:30:00 +0000</bug_when>
    <thetext>The problem is not with evaluation the variable: indeed, an optimizing processor does not need to evaluate a variable that is never referenced.

The issue here is with invoking the template. If the caller does not provide this parameter, it is in error.

I consider it similar to stylesheet functions. Take for instance:

&lt;xsl:function name=&quot;f:foo&quot;&gt;
    &lt;xsl:param name=&quot;x&quot; /&gt;
&lt;/xsl:function&gt;

The function body does nothing, $x is never evaluated, however, calling f:foo() (without a parameter) is illegal and will raise an exception, regardless of any optimization.

Yes, you never have to evaluate the parameter. No, you must raise an error on the caller if it does not provide a required parameter. Same goes for xsl:param with required=&quot;yes&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107577</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-06-10 13:01:38 +0000</bug_when>
    <thetext>Thanks for your response.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>