W3C home > Mailing lists > Public > www-html@w3.org > December 2004

Re: XHTML attributes and namespace, clarification needed

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 14 Dec 2004 13:48:44 +0100
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-html@w3.org, www-style@w3.org
Message-ID: <41cedefe.111444812@smtp.bjoern.hoehrmann.de>

* 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:01 GMT