W3C home > Mailing lists > Public > w3c-sgml-wg@w3.org > May 1997

Re: Distinguishing Attributes and Content

From: Matthew Fuchs <matt@wdi.disney.com>
Date: Tue, 20 May 1997 10:12:53 -0700
Message-Id: <9705201012.ZM21777@scrumpox.rd.wdi.disney.com>
To: Andrew Layman <andrewl@microsoft.com>, w3c-sgml-wg@w3.org
On May 19, 10:19am, Andrew Layman wrote:
> Subject: RE: SD1 - Short End Tags
> Several people have suggested that we could save as much space as short
> end tags offer by putting data into attributes rather than elements.
> One could turn this around and say that if we had short end tags, we
> would be much less motivated to put data into attributes!
> What this points out is the urgency of settling the question of whether
> there is a real distinction between contents and attributes. Once we
> know the answer to that, a great deal follows. I hope to post a large
> essay on that point later today.
>-- End of excerpt from Andrew Layman

A little intellectual sleight of hand could be useful here.  It is easy enough
to look at PCDATA as an empty element with a single _data_ attribute, i.e.
<element-with-data>Here's some data</element-with-data> ==
<element-with-data><pcdata data = "Here's some data"/></element-with-data>
This makes the document data attributes of the pcdata elements.  If the parent
element doesn't have mixed content we can hoist the content:
<element-with-data data = "Here's some data"/>.

The implication of this little trick is that data and attributes are leaves of
the document tree and therefore shouldn't have any structure (data being just a
privileged attribute).  Any appearance to the contrary is just a trick played
on us by the lexer to satisfy humans who would rather consider the markup as
embedded in the document, rather than the document embedded in the markup.
 This might also address the grove issue also brought up in this context,
although I haven't thought about that.

I doubt this little wrinkle is original, but it does provide a real distinction
between contents and attributes, and gives a cogent argument against structured
attributes.  My particular feeling is to design namespaces to handle whatever
people would want to do with structured attributes.

This application of Occam's razor :) brought to you by,

Matthew Fuchs

Received on Tuesday, 20 May 1997 13:11:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:26 UTC