Elements vs. Attributes


Newsgroups: comp.text.sgml
Date: 28 Apr 1992 14:15:55 UT
From: C. M. Sperberg-McQueen <U35395@uicvm.uic.edu>
Organization: University of Illinois at Chicago 
Message-ID: <92119.091555U35395@uicvm.uic.edu>
References: <9204271901.AA06192@ucbvax.Berkeley.EDU> 
Subject: Re: Tags vs Attributes

[. . .]

Ah, the old attribute-versus-tag question. The TEI's metalanguage committee went round and round on this for a long time and neither those who wanted to ban all attributes (except for IDs and IDREFs) nor those who wanted to all their unrestricted use were ever able to persuade each other. (We just put it to a vote and stopped talking about it.) Also, no one was ever able to provide a really clear universal rule for deciding when to use an attribute and when to use a tag (usually an embedded tag).

My personal rules of thumb, though, include these:

These are not failsafe, and I'm sure we can think of cases where they conflict, which is why I call them rules of thumb. Long disputes over whether attributes actually provided a richer language than would be available without them, however, eventually persuaded me that any markup language with attributes could be translated pretty much mechanically into one with only ID and IDREF attributes, and so I personally decided it wasn't such a fateful decision after all, but one you could back out of later if you really needed to. (But since going from attributes to embedded elements is clearly pretty simple and going the other way is much less simple, in the general case, the upshot is that in case of doubt I personally tend to lean toward attributes rather than elements.)

C. M. Sperberg-McQueen
ACH / ACL / ALLC Text Encoding Initiative
University of Illinois at Chicago