COL and COLGROUP

The wording of the spec and the DTD seem to disagree over COL and
COLGROUP elements.

Section 11.2.4 of html40 [1] says:

   The COL element allows authors to group together attribute
   specifications for table columns. The COL does not group columns
   together structurally -- that is the role of the COLGROUP element.
   COL elements are empty and serve only as a support for attributes.
   They may appear inside or outside an explicit column group (i.e.,
   COLGROUP element).

According to the last sentence, it would seem that the following
markup would be valid:

<table>
 <colgroup>
  <col>
  <col>
 </colgroup>
 <col>
 <thead>
  <tr>
... rest of table...
</table>

However, both the loose [2] and strict [3] DTD's say:

<!ELEMENT TABLE - -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>

This means that there can either be any number of COL elements, or any
number of COLGROUP elements (which *contain* COL elements).  However,
they cannot coexist as *direct children* of TABLE.  This makes the above
markup invalid.

Which is correct?  Should the DTD read:

<!ELEMENT TABLE - -
     (CAPTION?, (COL|COLGROUP)*, THEAD?, TFOOT?, TBODY+)>

or is the text in 11.2.4 wrong (or am I misinterpreting it)?

David Baron

[1] http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.2.4.2
[2] http://www.w3.org/TR/REC-html40/sgml/loosedtd.html
[3] http://www.w3.org/TR/REC-html40/sgml/dtd.html

--------------------------------------------------------------------
L. David Baron         | Freshman, Harvard
dbaron@fas.harvard.edu | < http://www.fas.harvard.edu/~dbaron/ >
--------------------------------------------------------------------

Received on Thursday, 14 January 1999 16:51:21 UTC