<?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>16034</bug_id>
          
          <creation_ts>2012-02-20 17:03:29 +0000</creation_ts>
          <short_desc>[XQ30] extvardef-016a &amp; 016b</short_desc>
          <delta_ts>2012-02-21 08:44:53 +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.0</component>
          <version>Member-only Editors Drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>16035</dup_id>
          
          <bug_file_loc>https://www.w3.org/XML/Group/qtspecs/specifications/xquery-30/html/xquery-30.html#id-context-item-declarations</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="Jonathan Robie">jonathan.robie</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>64309</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-02-20 17:03:29 +0000</bug_when>
    <thetext>I can&apos;t see anything in the specification to justify the expected behaviours of test extvar-def-016a &amp; 016b.  Specifically, I&apos;m looking at text in 4.17 Context Item Declaration.

extvar-def-016a:

        declare variable $y := (&lt;a&gt;1&lt;/a&gt;,&lt;a&gt;2&lt;/a&gt;,&lt;a&gt;3&lt;/a&gt;,&lt;a&gt;4&lt;/a&gt;,&lt;a&gt;5&lt;/a&gt;,&lt;a&gt;6&lt;/a&gt;,&lt;a&gt;7&lt;/a&gt;,&lt;a&gt;8&lt;/a&gt;,&lt;a&gt;9&lt;/a&gt;,&lt;a&gt;10&lt;/a&gt;);
        declare context item := $y[3];
        declare variable $x external := fn:position();
        $x

The test expects fn:position() to be 3.  While I can see where the expected result comes from (the context item points to the third item in $y), I can find no text which persuades me that evaluating $y[3] leaves the formatl semantics variable $fs:position as 3.

extvar-def-016b:

        declare variable $y := (&lt;a&gt;1&lt;/a&gt;,&lt;a&gt;2&lt;/a&gt;,&lt;a&gt;3&lt;/a&gt;,&lt;a&gt;4&lt;/a&gt;,&lt;a&gt;5&lt;/a&gt;,&lt;a&gt;
6&lt;/a&gt;,&lt;a&gt;7&lt;/a&gt;,&lt;a&gt;8&lt;/a&gt;,&lt;a&gt;9&lt;/a&gt;,&lt;a&gt;10&lt;/a&gt;);
        declare context item := $y;
        declare variable $x external := fn:last();
        $x

The test expects fn:last() to be 10.  Again, it&apos;s clear where this expected result comes from (count($y)), but I can find no text which leads me to believe that assigning $y to the context item will leave the formatl semantics variable $fs:last as 10.

This test also contains a type check error.  The context item&apos;s type may only be an ItemType, i.e. quantifier 1.  In this test, $y is bound to a sequence of 10 elements.  Therefore evaluating the context item would result in a type check error.  Thus this query should expect XPTY0004.

I believe that in the above, fn:position() and fn:last() can only ever return 1 (if the context item is defined) or raise an error (if the context item is not defined).

However, since the query doesn&apos;t require the evaluation of the context item, it may also expect 1.  Perhaps it might be preferable to consider the context item as undefined, and therefore fn:last() would raise XPDY0002.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64312</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-02-20 17:52:04 +0000</bug_when>
    <thetext>I&apos;m changing this to a bug on the spec, since the spec says absolutely nothing to help one decide what the result of this test should be.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64355</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-02-21 08:44:53 +0000</bug_when>
    <thetext>Thanks.  I had raised Bug 16035 against the specification, so I&apos;m marking this as a duplicate.

*** This bug has been marked as a duplicate of bug 16035 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>