Re: XHTML attributes and namespace, clarification needed

Werner Donné wrote:
> Daniel,
> 
> I think that the sentence "Note that default name spaces do not apply
> directly to attributes." means that attributes without an explicit
> name space binding, which are on an element that is not in the
> default name space, are not in the default name space.
> 
> By default attributes are local to their elements. The only thing to
> worry about is their uniqueness in the scope of their element. A
> name space is not required for this. So it would be natural to think
> of attributes having the name space of their element as their default
> name space, though that is not the case strictly speaking.
> 
> The XHTML spec says that class attributes must be recognised in the 
> XHTML name space. This doesn't imply that the class attributes have a
> name space themselves. The class attribute is also not global as in
> the XML Schema sense. They are in fact locally declared for each 
> element.

I'd say Werner hits the spot here... This is how I understand it works 
as well... I may be wrong but I had to look into this a while ago (I did 
it again just now) and I came to the same conclusion. It is just 
formalized a bit unclearly in the XML spec. This is also what makes 
sense to me, personally.

You are confused by the line "Note that default namespaces do not apply 
directly to attributes." (section 5.2 of XML Namespaces), which only 
says that it does not DIRECTLY apply (meaning that the 'test' attribute 
in <xsl:if test="."> doesn't live in the default namespace). Attributes 
inherit their namespace from the element they are on. This is 
additionally backed up by looking at practical examples like 
(especially) XSLT, XHTML and MathML, and of course by a little bit of 
common sense.

This would invalidate your second point...

Given the constraint on no duplicate attributes being allowed, I'd say 
it also makes sense if that constraint holds when the attribute has 
another namespace with the same namespace URI?

This is backed up by section 5.3 of the XML Namespaces document:
http://www.w3.org/TR/REC-xml-names/#uniqAttrs

"2. have qualified names with the same local part and with prefixes 
which have been bound to namespace names that are identical."

So I'd say your third point is not valid.

So, all in all, I think you are having a huge misunderstanding of the 
way XML works here. What's worse, there have been like 12 replies of 
which only one (Werner's) made sense to me.


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san!!

Received on Tuesday, 14 December 2004 20:53:06 UTC