<?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>29027</bug_id>
          
          <creation_ts>2015-08-05 10:43:32 +0000</creation_ts>
          <short_desc>[qt3] contextDecl-022</short_desc>
          <delta_ts>2015-11-03 12:57:59 +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>XQuery 3.1</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</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="Michael Kay">mike</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>jmdyck</cc>
    
    <cc>oneil</cc>
    
    <cc>tim</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>122462</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-08-05 10:43:32 +0000</bug_when>
    <thetext>This test case does

      &lt;environment&gt;
        &lt;context-item select=&quot;&apos;London&apos;&quot;/&gt;
      &lt;/environment&gt;
      &lt;test&gt; declare context item as xs:string := 2; . &lt;/test&gt;
      &lt;result&gt;
        &lt;any-of&gt;
          &lt;error code=&quot;XPTY0004&quot;/&gt;
          &lt;assert-eq&gt;&apos;London&apos;&lt;/assert-eq&gt;
        &lt;/any-of&gt;
      &lt;/result&gt;

I have some questions here about interpreting the spec.

Note that the context item is not declared &quot;external&quot;. 

(a) Given that the context item is not declared external, is it acceptable for the query to accept an externally-supplied value? If not, &quot;London&quot; is not a valid result.

(b) Saxon is actually producing a different error, saying that the query does not define an external context item and therefore it is an error to supply one. There&apos;s no such error defined in the spec, but it&apos;s a reasonable thing within the scope of API design.

I think we should avoid tests that stray into API-defined territory, and supplying an external context item to a query that does not expect one falls into this area.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122996</commentid>
    <comment_count>1</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2015-09-01 16:47:32 +0000</bug_when>
    <thetext>The WG agreed to reassign this bug against the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123092</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-09-04 21:00:49 +0000</bug_when>
    <thetext>Reading the spec again, it says [the value of the context item is]:

* If VarValue is specified, then the result of evaluating VarValue.

which I think leaves little wriggle room for suggesting that it might instead be something from the external environment. I&apos;d suggest adding a Note:

Note: if a context item declaration is present, and &quot;external&quot; is not specified, then the context item cannot be supplied externally. It is outside the scope of this specification whether an attempt to supply a context item externally is ignored, or results in an error.

We should change the test to remove the attempt to supply a context item externally, and remove &quot;London&quot; as a possible result.

I&apos;m not sure what to make of the statement in C.2 that the initial context item is &quot;overwriteable&quot; by implementations. If there&apos;s an initial context item declaration that gives the initial context item a value, I don&apos;t think we want to license implementations to ignore that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123095</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2015-09-05 02:22:26 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #2)
&gt; 
&gt; I&apos;m not sure what to make of the statement in C.2 that the initial context
&gt; item is &quot;overwriteable&quot; by implementations.

It made sense when the &quot;Default initial value&quot; of &apos;context item&apos; was &apos;none&apos;, but not so much when it changed to &apos;the initial context item&apos;.

I was about to describe what, to me, would be the right way to incorporate the 
initial context item into that table, when I found that I already did so (Member-only):
https://lists.w3.org/Archives/Member/w3c-xsl-query/2012Dec/0034.html

As far as I can tell, that message was never discussed at a meeting, and I must have just forgotten about it. But I still think it&apos;s correct.


&gt; If there&apos;s an initial context item declaration that gives the initial
&gt; context item a value, I don&apos;t think we want to license implementations
&gt; to ignore that.

Indeed, that&apos;s what we decided with respect to your bug 19267.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123745</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2015-10-16 20:58:18 +0000</bug_when>
    <thetext>This was fixed in passing when I addressed the same comment in Bug 29170.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123746</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2015-10-16 20:59:23 +0000</bug_when>
    <thetext>Aaargh, I resolved the wrong bug.  Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123817</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2015-10-21 10:08:43 +0000</bug_when>
    <thetext>Just to complicate matters, an imported module might declare an external context item, and the main module might declare it with VarValue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124054</commentid>
    <comment_count>7</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2015-11-03 12:57:59 +0000</bug_when>
    <thetext>test case changed accordingly to comment #2. Please close if happy with fix.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>