[tei-council] Attributes in no namespace

Syd Bauman s.bauman at neu.edu
Mon Dec 30 23:00:10 EST 2013


Thoughts interspersed between extracts of Martin's post ...


> That's what my ticket suggests:
> <https://sourceforge.net/p/tei/bugs/631/>

Righto. Just put my +1 on that.


> ... although it's easy to distinguish between identical attributes
> based on the namespace of their parent node in e.g. XPath, the fact
> is that they are technically the same attribute in the context of a
> multiple-namespace document, and their definitions are in conflict.

But two attributes in a single-namespace document may have the same
name, but because of context have different semantics. Moreover, if
the XML Namespaces spec had been written such that attributes inherit
the namespace of their parent element the same problem would occur.
So this doesn't bother me.


> ... we cannot import only an attribute from another specification
> to use as a child [sic] of our own elements (unless it happens to
> be explicitly defined with a namespace, such as e.g. @xlink:href);
> we can only import elements which carry it. That means we were
> unable to import and use the SVG @points attribute (for example)
> into TEI; we had to create our own mirror of it, with the slight
> risk that their definitions might diverge in the future.

Wow. *Really* good point. I think I have to re-think my thinking on
this issue.


> This seems to me to be a fundamental design flaw, and I simply
> don't understand it. Why did the designers of XML decide that
> attributes don't inherit the namespace of their parent elements? 

My limited (mis-?)understanding from conversations w/ MSMcQ is that 

a) The idea that non-NS-qualified attributes are "in no namespace" is
   not actually asserted in the Namespace spec.[1]

b) No one really thought of this or suggested it; most the WG
   members, or at least the big rich ones, were really only
   interested in elements. If the idea of making attributes inherit
   their parent elements namespace had been a requirement, the spec
   probably would have never made it at all.

c) In any case, namespaces in XML are so poorly defined he thinks
   this issue is a bit like complaining that your boat is the wrong
   color when it has a big hole in the bottom.

Notes
-----
[1] It says:
      Default namespace declarations do not apply directly to
      attribute names; the interpretation of unprefixed attributes is
      determined by the element on which they appear. ... The
      namespace name for an unprefixed attribute name always has no
      value. In all cases, the local name is local part (which is of
      course the same as the unprefixed name itself).
   I have to admit, I'm not sure right now what "determined by the
   element on which they appear" means. But I'm pretty tired.


More information about the tei-council mailing list