Re: XHTML attributes and namespace, clarification needed

* Daniel Glazman wrote:
>Can you please explain me why attributes applying to XHTML elements have
>to have no namespace ? Giving them a namespace is not a blocker for other
>vocabularies since it's possible to build an RNG schema defining only
>attributes.

Because that saves you from specifying the namespace each time you work
with an attribute, you would otherwise end up doing

  <p xhtml:align="...">                   in XHTML
  //xhtml:p[@xhtml:align]                 in XPath
  p.setAttributeNS("http://...", "align") in Script
  p[xhtml|align]                          in CSS
  ...

rather than

  <p align="...">                         in XHTML
  //xhtml:p[@align]                       in XPath
  p.setAttributeNS(null, "align")         in Script
  p[align]                                in CSS
  ...

which is important e.g. for authors who wish to use XHTML but need to
consider old user agents that do not properly support XHTML (e.g., if
the user agent is not able to render XHTML documents progressively...),
and generally to anyone who hates typing all those characters. As there
is not much to gain from having those attributes in a namespace, such a
requirement has been avoided. Or is your question why the XML Namespaces
specification does not consider attributes without prefix to be in the
namespace of the element they are attached to?
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 14 December 2004 12:49:01 UTC