This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3302 - Test suite assumes initial context item is undefined
Summary: Test suite assumes initial context item is undefined
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.9.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-24 23:50 UTC by David Carlisle
Modified: 2006-06-28 15:31 UTC (History)
1 user (show)

See Also:


Attachments

Description David Carlisle 2006-05-24 23:50:53 UTC
Several tests assume that . is initially undefined.
internalcontextitem-1
position-2
last-2
(and others, search for "no context node" 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

         <context-property name="Context item" value="empty document node" context-type="dynamic"/>

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 
 <context-property name="Context item" value="e

David
Comment 1 Carmelo Montanez 2006-05-25 14:07:14 UTC
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
Comment 2 David Carlisle 2006-05-25 20:17:26 UTC
(In reply to comment #1)

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

sure, that'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's not much you can say, as it can be any value of any type,or not a value at all.
In xq2xsl it'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's not possible to leave the context item unset in xq2xsl without limiting the range of queries that can be translated There's some discussion of this in the section on the "Current Node" in
http://monet.nag.co.uk/xq2xml//xq2xslnotes.html#s6

David
Comment 3 Carmelo Montanez 2006-05-30 15:35:46 UTC
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
Comment 4 Martin Probst 2006-05-31 08:46:58 UTC
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'm not completely through with XQTS 0.9.0 yet, so there may be more.
Comment 5 Carmelo Montanez 2006-06-15 18:32:35 UTC
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