W3C home > Mailing lists > Public > www-html-editor@w3.org > July to September 2002

[HLink Draft 2002-09-13] Eschew Magic Attribute Values

From: Arjun Ray <aray@nyct.net>
Date: Sat, 14 Sep 2002 21:32:53 +0000
To: www-html-editor@w3.org
Message-ID: <ed97ou4nijnn189mps1r32horgs9r0k2c7@4ax.com>

The HLink draft calls for each attribute of the <hlink> element to be
bimodal: the attribute value is either a direct literal or a pointer to
the value of an attribute in the element being described.

This is brittle design.  It calls for recognition of effectively "magic
syntax" within the value domain of the attribute taken as a literal.
There are cases where this is clearly harmless - as when the value domain
is an enueration of defined tokens (such as with the 'effect' attribute.)

However, if the value of an attribute is required to be a URI reference,
then AFAIK the value "@href" by itself is a perfectly legal URI reference
(albeit unusual), and consequently its interpretation as a "magic value"
referencing something else by name is inherently ambiguous.

Rather than relying on uniformly magic syntax across a number of value
domains, it would be better to drop the bimodality altogether and define
an attribute dedicated to the mapping function.

I have no talent for resonant names, so I nominate 'attmap'.  Its value is
defined to be a list of name tokens, where each pair is interpreted as a
mapping of corresponding values.  The first of each pair will thus be the
name of an attribute of the <hlink> element, the second a name of an
attribute of the definiendum.  

[Some details: There is an issue with the list having an odd number of
tokens; two rules are possible - either to subsume the function of the
'element' attribute into the first token, or to ignore the last token.   
There is an issue of duplicate definitions - only the first should count.
There is an issue of an attribute being defined both directly and through
the 'attmap' attribute - mandate that the attmap mapping is primary, the
direct specification only advisory.]

This technique is completely general, and requires no constraints on the
value domains of semantically significant attributes.  Here are the
relevant examples of 2.3 rewritten according to this modification:

1.  The definition of the <a href="..."> element in XHTML: 
<hlink namespace="http://www.w3.org/1999/xhtml"
       attmap="locator href replacement target"/>
2. Defining <img/> in XHTML 
<hlink namespace="http://www.w3.org/1999/xhtml"
       attmap="locator src"/>
<hlink namespace="http://www.w3.org/1999/xhtml"
       attmap ="locator longdesc"/>
<hlink namespace="http://www.w3.org/1999/xhtml"
       attmap="locator usemap"/>

3.  Defining <object> in XHTML 
<hlink namespace="http://www.w3.org/1999/xhtml"
       attmap="locator data"/>
5.  Defining redirection: 
<hlink namespace="http://www.example.com/markup"
       attmap="locator href"/>

Please, no magic syntax in values!
Received on Saturday, 14 September 2002 17:40:30 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:08:47 UTC