Dear XML Core WG,
Please would you be kind enough to advise on this conundrum.
This posting refers to the discussion on the NAR-dev conference call last Friday, 24 June. The issue was: do attributes inherit the namespace of its element and this way also default namespaces?
After some searching my findings are:
**  is the standard document of the W3C and it speaks about Applying Namespaces to Elements and Attributes (chapter 6) :
- 6.1 Namespace scoping:
“ The scope of a namespace declaration declaring a prefix extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner declarations with the same NSAttName part. In the case of an empty tag, the scope is the tag itself.
Such a namespace declaration applies to all element and attribute names within its scope whose prefix matches that specified in the declaration.”
With this example:
- 6.2 Namespace defaulting
“The scope of a default namespace declaration extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner default namespace declarations. In the case of an empty tag, the scope is the tag itself.
A default namespace declaration applies to all unprefixed element names within its scope. Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear.”
This leaves open what “determined by the element” exactly means – what we discussed last Friday: does the attribute inherit the element’s namespace – or not.
The next paragraph tells:
“ .... The namespace name for an unprefixed attribute name always has no value. ...”
... hm, this does not explain what “determined by the element” exactly means (Btw: the Errata document for this document says no errata exist ...). And there is no note available for the example above explaining if the @href pertains to the html: namespace or not.
** So I started to google for views on that issue:
* The German page (but not the one in English) about XML namespaces talks explicitly about attributes  – in short: as attributes are not a child node of an element they never inherit its namespace, if one wants to apply a namespace the corresponding prefix has to be applied.
* A website with “Articles and tutorials about XML-technology”  says about this issue: “An attribute is not considered a child of its parent element. An attribute never inherits the namespace of its parent element.”
* A VB tutorial about XML namespaces asserts the same 
* The only contradiction I found is on Stackoverflow 
“There's a reason that most XML vocabularies use non-namespaced attributes:
When your elements have a namespace and those elements have attributes, then there can be no confusion: the attributes belong to your element, which belongs to your namespace. Adding a namespace prefix to the attributes would just make everything more verbose.
So why do namespaced attributes exist?
Because some vocabularies do useful work with mostly attributes, and can do this when mixed in with other vocabularies.”
- W3C does not define how default namespaces apply to attributes in a straightforward way
- It is not fully clear if an attribute of a namespaced element interits its namespace.
- Published views on that matter lean towards “does not inherit” – but not unambiguously
What’s next: asking one of the editors of this document – Tim Bray or Henry Thompson?
Managing Director of the IPTC [[hidden email]]
Business office address:
20 Garrick Street, London WC2E 9BT, United Kingdom
Registered in England, company no 101096
This email was sent to you by Thomson Reuters, the global news and information company. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
-----BEGIN PGP SIGNED MESSAGE-----
A brief but partial response, as a full one will take some time.
1) Unprefixed attributes are never in a namespace.
2) The intention of the phrase "determined by the element" is that
given an unprefixed attribute the _semantics_ of that attribute are
the responsibility of its owner element.
Thus in e.g. <person title=...> and <book title=...>
the title attribute may receive very different interpretations.
'person' and or 'book' may be in a namespace, in which case you
have a good idea of where to look for information about those
elements and, in turn, their unprefixed attributes.
Hope this helps.
Henry S. Thompson, School of Informatics, University of Edinburgh
10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 651-1426, e-mail: [hidden email]
[mail from me _always_ has a .sig like this -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
-----END PGP SIGNATURE-----
|Free forum by Nabble||Edit this page|