Re: Applying namespaces to unprefixed attribute names

>    <Stuff  xmlns       ="urn:Pies"
>            xmlns:cakes ="urn:Cakes"
>    >
>      <a       y="123/>
>      <cakes:b z="123/>
>    </Stuff>
> 
> I am looking for some part of the spec that explains what namespaces 
> apply to "y" and "z".  I'm guessing that each of the two attributes gets 
> its namespace from its element, so that y's namespace is a's namespace, 
> which is "urn:Pies", and z's namespace is cakes:b's namespace, which is 
> "urn:Cakes".  But this is just my guess.

The interpretation is of an unprefixed attribute is determined by the
element it belongs to.  But it's best to think of them as being an no
namespace, and this is consistent with the approach taken in standards
such as XPath, where an unprefixed attribute's namespace uri is null.

If you like, you can take the approach suggested in the
(non-normative) appendix, and consider them to be in a sort of
sub-namespace belonging to the element they are attached to.  But this
is not the same as the element's own namespace.

Either way, given <cakes:b z="123" cakes:z="123">, the attributes z
and cakes:z are not the same.

-- Richard

Received on Wednesday, 2 November 2005 13:32:06 UTC