[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: your comments on 4.6.1 Namespaces and Attributes



I still feel that section 4.7.1 (in the current draft) is entirely
misleading.

In particular,

- it talks about the "meaning" and "interpretation" of attributes. The XML
(and namespace) recommendations define syntax, not interpretation

- the statement that attributes are interpreted differently based on whether
they are qualified or not isn't based on the recommendations -- it may be a
"best practice", but then it should be described as such.


I *do* like the statements about how qualified attributes can be attached to
elements in other namespaces, but again this is just a best practice.

So here's something I'd prefer:

4.7.1 Namespaces and Attributes

There is a frequently misunderstood aspect of the relationship between
unprefixed attributes and the default XML namespace - the natural assumption
is that an unprefixed attribute is qualified by the default namespace, but
this is not true.  Rather, the unprefixed attribute belongs to no namespace
at all.  Thus, in the following:

      <ns1:fox a="xxx" ns1:b="qqq"/>

the attribute "a" is in no namespace, while "ns1:b" is the same namespace as
the containing element.

In XML applications, the choice between prefixed and non-prefixed attributes
frequently is based on whether they always appear inside elements of the
same namespace (in which case non-prefixed and thereby non-namespaced names
are used) or whether it's required that they can be applied to elements in
arbitary other namespaces (in which case a prefixed name is used).

Both situations occur in the XSLT language: while attributes are unprefixed
when they occur inside elements in the XSLT namespace, such as

  <xsl:value-of select="."/>

they are prefixed when they appear in non-XSLT elements, such as when using
"literal result element stylesheets":




> -----Original Message-----
> From: owner-ietf-xml-use@xxxxxxxxxxxx
> [mailto:owner-ietf-xml-use@xxxxxxxxxxxx]On Behalf Of David Waite
> Sent: Thursday, June 06, 2002 7:47 PM
> To: ietf-xml-use
> Subject: Re: your comments on 4.6.1 Namespaces and Attributes
>
>
>
> Julian Reschke wrote:
>
> >I still have problems with this section (which is now at 4.7.1):
> >
> ><quote>
> >4.7.1 Namespaces and Attributes
> >
> >   There is a frequently misunderstood aspect of the relationship
> >   between unprefixed attributes and the default XML namespace - the
> >   natural assumption is that an unprefixed attribute is qualified by
> >   the default namespace, but this is not true.  Rather, the unprefixed
> >   attribute belongs to a set of attributes that are defined
> >   specifically for the element to which it is applied.  Thus, in the
> >   following:
> >
> >      <ns1:fox a="xxx" n:b="qqq"/>
> >      <ns1:bay a="yyy" n:b="rrr"/>
> >      <ns2:baz a="zzz" n:b="sss"/>
> >
> >   The meaning of attribute "a" is defined separately for each
> >   attribute.  By comparison, the prefixed attribute "n:b" is defined
> >   independently of the element to which it is applied.
> ></quote>
> >
> >1) It's true that unprefixed attributes inherit a default namespace. They
> >are technically in no namespace.
> >
> >2) It's new to me that being prefixed or not carries *any* hint about
> >whether the attribute is "defined" (BTW: what is meant by
> 'defined' in this
> >context) specifically for an element or not. Can you cite the XML
> >recommendation or XML Infoset to back this up? Otherwise the
> text needs at
> >least to be clarified.
> >
> >
> Its not so much the 'definition' of the attribute, but more on the
> 'context' of the attribute. Non-prefixed attributes are dependant on and
> live within the context of the element, while prefixed attributes are
> global attributes, and are not dependant of the context of a particular
> element. How they are defined really depends on the particular type of
> schema you are using.
>
> Also, any distinction based on context is usually considered
> document-specific; SOAP for example prefixes all attributes used within
> its headers. Once you accept the document format defines the use of
> prefixed/nonprefixed attributes,  it really only becomes an issue for
> canonicalization (and unfortunately I haven't read the c14n
> recommendation yet to know their take on the whole thing).
>
> -David Waite
>