<?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>3302</bug_id>
          
          <creation_ts>2006-05-24 23:50:53 +0000</creation_ts>
          <short_desc>Test suite assumes initial context  item is undefined</short_desc>
          <delta_ts>2006-06-28 15:31:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Query Test Suite</product>
          <component>XML Query Test Suite</component>
          <version>0.9.0</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</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="David Carlisle">davidc</reporter>
          <assigned_to name="Carmelo Montanez">carmelo</assigned_to>
          <cc>martin</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9891</commentid>
    <comment_count>0</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2006-05-24 23:50:53 +0000</bug_when>
    <thetext>Several tests assume that . is initially undefined.
internalcontextitem-1
position-2
last-2
(and others, search for &quot;no context node&quot; in the catalogue.)
Typically the catalogue expects an error in these cases.

xq2xsl in fact always supplies an intial context item 
which is allowed by the XQuery spec, and the results schema
even has slots for me to specify what this is

         &lt;context-property name=&quot;Context item&quot; value=&quot;empty document node&quot; context-type=&quot;dynamic&quot;/&gt;

so for example 
internalcontextitem-1
need not return an error, in fact it should not return an error if the
system is reporting any value in 
 &lt;context-property name=&quot;Context item&quot; value=&quot;e

David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9893</commentid>
    <comment_count>1</comment_count>
    <who name="Carmelo Montanez">carmelo</who>
    <bug_when>2006-05-25 14:07:14 +0000</bug_when>
    <thetext>David:

Thanks for the message.  This is a bit of a tough one, since the return value may differ them from one implementation to another.  Andrew any comments?

Carmelo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9894</commentid>
    <comment_count>2</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2006-05-25 20:17:26 +0000</bug_when>
    <thetext>(In reply to comment #1)

&gt; This is a bit of a tough one, since the return value
&gt; may differ them from one implementation to another. 

sure, that&apos;s the price you pay for specifing things as system dependent, they depend on the system:-)

If the tests are really trying to test the behaviour when there is no context item, then there is an easy change to make, just define a simple xquery function
and move the current expression into the query body, which then will be specified  as having no context item set.

If the test is really testing what the initial context is then there&apos;s not much you can say, as it can be any value of any type,or not a value at all.
In xq2xsl it&apos;s the integer 1.
(it used to be an empty document node, but this made queries that pass on other systems silently do the wrong thing, making it an atomic value means that
relative paths fail unless you explictly set the input to be a node, so most practical queries work in a similar way to as if the context item was not set.)

It&apos;s not possible to leave the context item unset in xq2xsl without limiting the range of queries that can be translated There&apos;s some discussion of this in the section on the &quot;Current Node&quot; in
http://monet.nag.co.uk/xq2xml//xq2xslnotes.html#s6

David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9903</commentid>
    <comment_count>3</comment_count>
    <who name="Carmelo Montanez">carmelo</who>
    <bug_when>2006-05-30 15:35:46 +0000</bug_when>
    <thetext>Hey Dave:

Thanks for the comment and suggestion.  I think, I will follow it.
Do you have a list of all tests with this issue.  I can attempt and 
get them from the catalog, but I am sure a few will be missed.

Thanks,
Carmelo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9909</commentid>
    <comment_count>4</comment_count>
    <who name="Martin Probst">martin</who>
    <bug_when>2006-05-31 08:46:58 +0000</bug_when>
    <thetext>X-Hive/DB has the same issue, you always execute XQuerys against some node in the database, so there is always a context item, and it even makes sense and is useful :-)

The tests I have identified so far:

fn-base-uri-22
base-URI-8
last-2
fn-local-name-23
fn-number-3
fn-number-4
context-item-1
fn-string-3
externalcontextitem-1

I&apos;m not completely through with XQTS 0.9.0 yet, so there may be more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10047</commentid>
    <comment_count>5</comment_count>
    <who name="Carmelo Montanez">carmelo</who>
    <bug_when>2006-06-15 18:32:35 +0000</bug_when>
    <thetext>David:

I corrected these and some others.  Hopefully there will bo none more.
Please close the bug if in agreement and able to verify.

Thanks,
Carmelo</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>