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 3778 - 3.7.1.2: description for xmlns/xml is contradictory
Summary: 3.7.1.2: description for xmlns/xml is contradictory
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: Other Linux
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-29 16:07 UTC by Frans Englich
Modified: 2006-10-16 11:47 UTC (History)
0 users

See Also:


Attachments

Description Frans Englich 2006-09-29 16:07:45 UTC
In 3.7.1.2 Namespace Declaration Attributes, the last point reads:

It is a static error [err:XQST0070] if a namespace declaration attribute binds a namespace URI to the predefined prefix xml or xmlns, or binds a prefix other than xml to the namespace URI http://www.w3.org/XML/1998/namespace.

Consider this query:

   <e xmlns:xml="http://www.w3.org/XML/1998/namespace"/>

Valid or not? On one hand it "binds a namespace URI to the predefined prefix xml"(invalid) but on the other hand it binds a prefix to the namespace "http://www.w3.org/XML/1998/namespace" that isn't 'other than "xml"'(valid). This makes me think the paragraph is contradictory.

Assuming this is the intent:

* One may never bind to the prefix 'xmlns'
* One may only bind "http://www.w3.org/XML/1998/namespace" to "xml"
* "xml" may only be bound to "http://www.w3.org/XML/1998/namespace"

I suggest replacing the paragraph with:

'It is a static error[err:XQST0070] if a namespace declaration attribute binds a namespace URI to the predefined prefix "xmlns" or binds the namespace URI "http://www.w3.org/XML/1998/namespace" and the predefined prefix "xml" to anything but themselves.'

A clearer version is welcome.

Some info:
* The XQTS appears to have no tests for '<e xmlns:xml="http://www.w3.org/XML/1998/namespace"/>'
* Saxon 8.8J signals XQST0070 on the above query.
Comment 1 Michael Kay 2006-09-29 16:44:16 UTC
>'It is a static error[err:XQST0070] if a namespace declaration attribute binds a namespace URI to the predefined prefix "xmlns" or binds the namespace URI "http://www.w3.org/XML/1998/namespace" and the predefined prefix "xml" to anything but themselves.'

>A clearer version is welcome.

When in doubt, split it up.

"It is a static error [err:XQST0070] if a namespace declaration attribute binds a namespace URI to the predefined prefix "xmlns".

"It is a static error [err:XQST0070] if a namespace declaration attribute binds a namespace URI other than http://www.w3.org/XML/1998/namespace to the prefix "xml", or if it binds the namespace URI http://www.w3.org/XML/1998/namespace to a prefix other than "xml".

Michael Kay
Comment 2 Don Chamberlin 2006-10-02 16:35:14 UTC
I see no ambiguity here. Let A be the proposition "A namespace declaration attribute binds a namespace URI to the prefix xml or xmlns." Let B the the proposition "A namespace declaration attribute binds a prefix other than xml to the namespace URI http://www.w3.org/XML/1998/namespace." In terms of these propositions, the XQuery spec currently says "It is a static error [XQST0070] if A or B."

The query in your example satisfies proposition A but not proposition B. Therefore it is a static error. Saxon 8.8J raises [XQST0070], which is the correct behavior. XQTS does not test this behavior, which is not surprising because this is an exceedingly obscure case that provides no useful functionality. If some system fails to raise [XQST0070] when a query rebinds the prefix xml to the URI that it is already bound to, I don't think anybody will care.

I think the current design is correct because it allows implementations to raise an error on any binding of "xml", without the burden of checking what the prefix is bound to. No useful functionality is compromised by this design, and the design is clearly and unambiguously specified in the current document. I do not see a reason to change anything here.

Regards,
Don Chamberlin (personal response)
Comment 3 Michael Kay 2006-10-02 16:52:09 UTC
But XML allows one to write 

<a xmlns:xml="http://www.w3.org/XML/1998/namespace"/>

and unless there's a very good reason, if XML allows it then XQuery should allow it.
Comment 4 Don Chamberlin 2006-10-11 21:22:44 UTC
Frans,
On Oct. 3, 2006, the Query Working Group decided to resolve this issue by adopting the wording proposed by Michael Kay in Comment #1. According to this wording, it is not an error to explicitly bind the prefix xml to its predefined namespace URI. If you are satisfied with this resolution, please change the status of this bug report to Closed.
Regards,
Don Chamberlin (for the Query Working Group)