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 5089 - [XQuery] Namespace undeclarations in the query prolog
Summary: [XQuery] Namespace undeclarations in the query prolog
Status: RESOLVED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: 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: 2007-09-29 20:57 UTC by Michael Kay
Modified: 2008-01-08 18:57 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2007-09-29 20:57:56 UTC
I can write in the query prolog

declare namespace prefix = "";

and the meaning is given in 4.12: "any existing namespace binding for the given prefix is removed from the statically known namespaces."

But what does "existing" mean? Is the order of declarations in the prolog significant? Does

declare namespace prefix = "";
declare namespace prefix = "http://www.w3.org/ns/query";

have a different effect from

declare namespace prefix = "http://www.w3.org/ns/query";
declare namespace prefix = "";

If the namespace declarations are intended to be processed in the order in which they appear, then this ought to be stated.

Alternatively, we could state that both the above are errors. This could be achieved by changing the sentence: "The namespace prefix specified in a namespace declaration must ... not be the same as any namespace prefix bound in the same module ..." to say "bound or unbound", or words to that effect. Perhaps this was the intended meaning.
Comment 1 Michael Kay 2007-10-09 22:04:34 UTC
Several members of the WG felt that only one reading of the current text was possible, and that it was clear that namespace declarations and undeclarations could not coexist in the prolog. However, detailed scrutiny of the text revealed some problems, for example the definition of "namespace declaration" in the first paragraph leaves it ambiguous whether the term includes the undeclaration case or not. MHK and MSMQ actioned to propose revisions.
Comment 2 Michael Kay 2007-10-16 13:06:16 UTC
Proposal. In 4.12 after the production rule, add a new paragraph:

A NamespaceDecl represents a *Namespace Declaration* or (when the URILiteral is zero-length) a *Namespace Undeclaration".

In the second paragraph, replace "If the URILiteral part of a namespace declaration is a zero-length string, any existing namespace binding for the given prefix is removed from the statically known namespaces." with "[Definition: A Namespace Undeclaration removes any existing namespace binding for the given prefix from the statically known namespaces.]"

In the 7th paragraph, starting "The namespace prefix specified in a namespace declaration ..." change both occurrences of "declaration" to "declaration or undeclaration".
Comment 3 Michael Dyck 2007-10-16 19:29:28 UTC
(In reply to comment #2)
> 
> In the 7th paragraph, starting "The namespace prefix specified in a namespace
> declaration ..." change both occurrences of "declaration" to "declaration or
> undeclaration".

Note that the phrase "and must not be the same as any namespace prefix bound in the same module by [various constructs]" is still slightly problematic, since an undeclaration does not bind a prefix. Maybe change "bound" to "bound or unbound".
Comment 4 Michael Kay 2007-10-23 15:47:11 UTC
There was some concern from Jonathan that this change might force us to change more occurrences of "Namespace Declaration" to "Namespace Declaration or Undeclaration". It might be easier to explain that the term "Namespace Declaration" covered both.
Comment 5 Don Chamberlin 2008-01-08 18:57:40 UTC
Michael,
This bug report was discussed by the XQuery working group on 8 Jan 2008. It was the consensus of the group that the current specification is sufficiently clear and that no change is necessary. An existing rule in XQuery Section 4.12 specifies error XQST0033 if two namespace declarations in the same module attempt to bind the same namespace prefix. This rule is intended to apply to any case in which the same namespace prefix appears in two namespace declarations. The working group does not believe that it is necessary to introduce a new definition for a "namespace undeclaration". If you accept this resolution, please mark this bug as "Closed."
--Don Chamberlin (for the XQuery Working Group)