[Bug 4443] [XQuery] Unspecified how unprefixed attributes with namespace URIs are to be treated

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4443





--- Comment #9 from Tim Mills <tim@cbcl.co.uk>  2008-06-25 12:57:28 ---
Frans - not sure what you mean here.  Bug 4463 prevents invalid attribute
names.

I pieced together how the text would read with Bug 4463 and Comment #2 in
place.

"If the keyword attribute is followed by a name expression, the name expression
is processed as follows:

   1. Atomization is applied to the result of the name expression. If the
result of atomization is not a single atomic value of type xs:QName, xs:string,
or xs:untypedAtomic, a type error is raised [err:XPTY0004].

   2. If the atomized value of the name expression is of type xs:QName:

        a. If the expanded QName returned by the atomized name expression has a
        namespace URI but has no prefix, it is given an
implementation-dependent
        prefix. NOTE: This step is necessary because the default namespace does
not
        apply to attributes. Therefore any attribute name that has a namespace
URI must
        also have a prefix.

        b. The resulting expanded QName (including its prefix) is used as the
node-name
        property of the constructed attribute node.


   3. If the atomized value of the name expression is of type xs:string or
xs:untypedAtomic, that value is converted to an expanded QName. If the string
value contains a namespace prefix, that prefix is resolved to a namespace URI
using the statically known namespaces. If the string value contains no
namespace prefix, it is treated as a local name in no namespace. The resulting
expanded QName (including its prefix) is used as the node-name property of the
constructed attribute. If conversion of the atomized name expression to an
expanded QName is not successful, a dynamic error is raised [err:XQDY0074].

A dynamic error [XQDY0044] is raised if the node-name of the constructed 
attribute node has any of the following properties:
(a) Its namespace prefix is xmlns
(b) It has no namespace prefix and its local name is xmlns
(c) Its namespace URI is http://www.w3.org/2000/xmlns/
(d) Its namespace prefix is xml and its namespace URI is not 
http://www.w3.org/XML/1998/namespace
(e) Its namespace prefix is other than xml and its namespace URI is 
http://www.w3.org/XML/1998/namespace"


Consider the query:

attribute { fn:QName('http://www.example.com/', 'xmlns') } { 'foo' }

Because this attribute will have magically gained a prefix by rule (2a), this
won't hit rule "(b) It has no namespace prefix and its local name is xmlns".

That doesn't seem intuitive to me at least.  Nor does it seem intuitive that

empty(
  prefix-from-QName(
    node-name(
      attribute { fn:QName('http://www.example.com/', 'foo') } { 'foo' }
    )
  )
)

should not be false.

XQuery 3.7.4 rules will introduce a namespace prefix when copying such an
attribute.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 25 June 2008 12:58:02 UTC