Re draft-ietf-html-tables-00.txt

Terry Allen (
Sat, 22 Jul 95 19:17:29 EDT

I tried to parse the DTD contained in Dave's table I-D
and found some problems. Here's a corrected version of the DTD.
And everybody, please parse your proposed DTDs with a validating
parser before posting them!

Changes may be found by searching for "Terry."

Note that if you want to use this DTD on its own (using the doctype
TABLE) you need to add parameter entities for %text; and %body.content;,
such as

<!entity % text "#pcdata">
<!entity % body.content "#pcdata">

but that's no error.

<!-- The HTML Table DTD -->

<!-- border styles (overridden by style sheets)

none suppress borders - useful with graphics etc.
frame outer border around table only
basic border between thead/tbody and tbody/tfoot
rows as per basic plus frame plus row separators
cols as per basic plus frame plus column separators
all draw borders around all cells

<!ENTITY % border.styles
"none | frame | basic | rows | cols | all">

<!-- horizontal alignment attributes for cell contents -->

<!ENTITY % cell.halign
"align (left|center|right|justify|char) #IMPLIED
char CDATA #IMPLIED -- alignment char, e.g. align=':' --
charoff CDATA #IMPLIED -- offset of alignment char, eg charoff='50%' --"

<!-- vertical alignment attributes for cell contents -->

<!ENTITY % cell.valign
"valign (top|middle|bottom) #IMPLIED"

%body.content allows table cells to contain headers, paras,
lists, form elements and even arbitrarily nested tables.

%text is text characters, including character entities and
character emphasis elements, IMG and anchors

<!ELEMENT table - - (caption?, (colw|hspec|vspec)*, thead?, tbody, tfoot?)>
<!ELEMENT caption - O (%text)+>
<!ELEMENT hspec - O EMPTY>
<!ELEMENT vspec - O EMPTY>
<!ELEMENT thead - O (tr+)><!-- Terry added delimiters () around content -->
<!ELEMENT tbody O O (tr+)><!-- of thead, tbody, tfoot, body.content -->
<!ELEMENT tfoot - O (tr+)>
<!ELEMENT tr - O (th|td)+>
<!ELEMENT (th|td) - O (%body.content;)>

<!ATTLIST table
width CDATA #IMPLIED -- table width relative to window --
cols NUMBER #IMPLIED -- used for immediate display mode --
border (%border.styles) #IMPLIED -- see above definition --
nowrap (nowrap) #IMPLIED -- disable word wrap inside table --

<!ATTLIST caption
align (top|bottom) #IMPLIED -- relative to table --

<!ATTLIST colw -- specifies relative column widths --
col CDATA #REQUIRED -- column number or range --
width CDATA #REQUIRED -- positive number, e.g. 2.5 --

<!-- hspec and vspec elements specify alignment properties
for table cells and act like IF-THEN rules. The IF part is
a conjunction of the following optional parts:

a) whether the cell is in thead, tbody or tfoot (rowgroup)
b) the class attribute of the current row (rowclass)
c) whether the cell is a header or data cell (celltype)
d) the class attribute of the cell itself (cellclass)
e) the cell's row and/or column number (row or col)

If the cell straddles two or more rows or columns, the number
of the first row/column is used for evaluating the match.

The THEN part sets the horizontal or vertical alignment for
the cell's contents. The class attribute of the hspec or tspec
element matching a cell can also be used by style sheets to
attach additional rending properties to groups of cells.

Conflict resolution is real simple:

a) properties defined as attributes on cells always
override hspec or vspec

b) hspec and vspec are lexically ordered from general
to specific, i.e. the last matching hspec or vspec
elements sets the cell's alignment properties

<!ATTLIST hspec
rowgroup (thead|tbody|tfoot) #IMPLIED -- enclosing row group --
rowclass CDATA #IMPLIED -- class of enclosing row --
celltype (th|td) #IMPLIED -- header, data or either --
cellclass CDATA #IMPLIED -- class of cell itself --
%cell.halign; -- implied horizontal alignment --

<!ATTLIST vspec
rowgroup (thead|tbody|tfoot) #IMPLIED -- enclosing row group --
rowclass CDATA #IMPLIED -- class of enclosing row --
celltype (th|td) #IMPLIED -- header, data or either --
cellclass CDATA #IMPLIED -- class of cell itself --

<!ATTLIST tr -- table row --

<!ATTLIST (th|td) -- header or data cell --
class CDATA #IMPLIED -- Terry removed unwanted right angle bracket --
%cell.halign; -- horizontal alignment --
%cell.valign; -- vertical alignment --
axis CDATA #IMPLIED -- defaults to cell content --
axes CDATA #IMPLIED -- list of axis names --


Terry Allen  (   O'Reilly & Associates, Inc.
Editor, Digital Media Group    101 Morris St.
			       Sebastopol, Calif., 95472

A Davenport Group sponsor. For information on the Davenport Group see or