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 2501 - ForExprType009 uses incorrect namespace prefixes
Summary: ForExprType009 uses incorrect namespace prefixes
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.8.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Andrew Eisenberg
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-10 23:59 UTC by Michael Kay
Modified: 2006-06-19 21:29 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-11-10 23:59:07 UTC
ForExprType009 uses namespace prefixes in the result file that were not present
in the source file. Since this query is selecting elements from the source
document (it is not creating new elements) the namespace prefixes that were
present in nodes in the source document should be retained in the serialization.

The error affects both versions of the expected results.
Comment 1 Mike Rorke 2005-11-15 17:57:31 UTC
Fixed typo
Comment 2 Michael Kay 2006-01-09 14:38:55 UTC
This error is still present in version 0.8.4.
Comment 3 Mike Rorke 2006-01-12 18:54:37 UTC
I checked in the latest CVS sources and the namespaces for the query, results 
and source file all seem to match up (http://www.w3.org/XQueryTestOrderBy). 
Possibly this change hasn't made it into an official release yet. If you see 
this again, can you include the file names for the query/results where the 
wrong namespace appears, as well as the incorrect namespace string.
Comment 4 Marc Van Cappellen 2006-02-24 22:36:54 UTC
This error seems still to be present in 0.8.6

The expected result for ForExprType009 reads as follows:
<xqt:NegativeNumbers xmlns:xqt="http://www.w3.org/XQueryTestOrderBy">...

Where it should be:
<NegativeNumbers xmlns="http://www.w3.org/XQueryTestOrderBy">
Comment 5 Mike Rorke 2006-02-27 18:37:23 UTC
I beleive the expected results that are listed in the catalog are correct. The 
query reads as follows:

for $num as element(xqt:NegativeNumbers) in $input-
context/xqt:DataValues/xqt:NegativeNumbers
return $num

Therefore, the outer container element (NegativeNumbers) will be in the xqt 
namespace, not in the 'no-namespace' namespace.
Comment 6 Michael Kay 2006-02-27 19:00:18 UTC
The issue is not what namespace (URI) the element should be in, but what prefix
it should have. That was made clear when I first raised this bug report.

Michael Kay
Comment 7 Mike Rorke 2006-02-27 19:11:00 UTC
So, the core issue here is the prefix of the root element. In the source 
document, there is a default namespace that this element appears in. In the 
query, we change this to an explicit namespace. 

Michael beleives that we should preserve the fact that the origional soruce 
document had a default namespace. As far as I know, there is no requirement in 
the language that says we have to preserve these namespaces - so we should be 
able to replace the default element namespace with an explicit namespace prefix.

I have been out of the loop on this for a while now, so I am not sure this is 
true anymore :) I assigned this bug back to Andrew for discussion within the 
TTF.
Comment 8 Michael Kay 2006-02-27 19:43:13 UTC
The query is this:

for $num as element(xqt:NegativeNumbers) in
$input-context/xqt:DataValues/xqt:NegativeNumbers
return $num

This is selecting a sequence of elements in the source document (a singleton
set, as it happens), and serializing them. The elements in the source document
have a node-name() property which is a triple: (prefix="",
uri="http://www.w3.org/XQueryTestOrderBy", local="NegativeNumbers"). The effect
of the "sequence normalization rules" in section 2 and the "round-tripping"
rules in section 5 of the serializer spec is that the node-name property of the
nodes (all three components) must be preserved through serialization.

The query does not modify the source document, and the namespace prefixes used
in the query are not visible to the serializer, so there can be no doubt that
the prefix in the serialized output must be the same as in the input, that is,
the empty prefix "".

Michael Kay
Comment 9 Marc Van Cappellen 2006-05-16 20:30:57 UTC
In XQTS 0.9.0, there are 2 expected results for the test ForExprType009

ForExprType009.xml is correct, it uses the default namespace.
However, the alternate result ForExprType009-1.xml still assumes incorrectly the xqt prefix:
<xqt:NegativeNumbers xmlns:xqt="http://www.w3.org/XQueryTestOrderBy">...
Where it should be:
<NegativeNumbers xmlns="http://www.w3.org/XQueryTestOrderBy">...

Thanks,
Marc
Comment 10 Carmelo Montanez 2006-05-18 20:48:19 UTC
Marc/Michael:

We discussed this issue at the telecon today and agreed that the prefix be removed from th etop element,that is

<xqt:NegativeNumbers xmlns:xqt="http://www.w3.org/XQueryTestOrderBy">...

Where it should be:
<NegativeNumbers xmlns="http://www.w3.org/XQueryTestOrderBy">

I am not sure if the additional file is actually necessary.  Leaving it there
for now.  I will mark this bug as fixed.

Thanks,
Carmelo
Comment 11 Marc Van Cappellen 2006-05-22 07:48:57 UTC
Carmelo,

concerning your question:
> I am not sure if the additional file is actually necessary. 
> Leaving it there for now.

Both results are needed; one for PSVI-based implementations, the other for Infoset ones.
As you probably remember, various bugs on this subject have been filed in the past.

I hope this helps,
Marc
Comment 12 Marc Van Cappellen 2006-06-17 21:52:13 UTC
Comment #10 does not seem to be fixed in 9.4.0
Comment 13 Carmelo Montanez 2006-06-19 21:29:40 UTC
Marc:

Correct.  This is my oversight.  Corrected alternate results.

Thanks,
Carmelo