--------
<table border>
<caption>A more complex table</caption>
<th rowspan=2><th colspan=2>Average<th rowspan=2>other<br>category<tr>
<th>Height <th>Weight <tr>
<th align=left>Males <td>1.9 <td>0.003 <td>yyy <tr>
<th align=left>Females <td>1.7 <td>0.002 <td>xxx
</table>
--------
I really like this. It's clean and neat --- pretty easy to understand.
Rows and columns that have been "spanned" effectively disappear. I think
that most things could be placed inside a cell, including a sub-table.
The table system does introduce quite a few more tags though. And it seems
that a lot of this functionality is very similar to what lists do. Here's
what I consider to be a more general implementation:
--------
<!-- I don't know exactly how people want to implement the style database,
so this should just be used as a concept. The database should probably
appear in the head, but it's also useful to define style attributes
where the entity they refer to appears. The styles used in this
example would probably be standardized by the HTML specification. -->
<style>
*caption.align: center
*label.weight: bold
*table*border: 1
*table*p.align: center
*table*alignCousins: true
</style>
<!-- Cousins are children of different boxes which are children of the same
box. A browser creates default cousin relations between boxes. These
relationships are useful during the layout algorithm. They can be
explicitly defined for special effects. -->
<vbox>
<p style="caption">Table 1: A more complex table</p>
<vbox style="table">
<hbox>
<br> <!-- The break element creates an empty box. <p> </p> works too -->
<vbox>
<p style="label">Average</p>
<hbox>
<p style="label" id="hcol">Height</p>
<p style="label">Weight</p>
</hbox>
</vbox>
<p style="label">Other Category</p>
</hbox>
<hbox>
<p style="label">Males</p> <p cousin="hcol">1.9</p> <p>0.003</p> <p>yyy</p>
</hbox>
<hbox>
<p style="label">Females</p> <p>1.7</p> <p>0.002</p> <p>xxx</p>
</hbox>
</vbox>
</vbox>
--------
The following syntax extensions make tables easier to work with:
<table> { addAttribute(*Box*border: 0); <vbox style="table"> }
<table border> { addAttribute(*Box*border: 1); <vbox style="table"> }
</table> { </vbox> }
<caption> { tableCount is tableCount + 1; <p style="caption"> Table tableCount: }
</caption> { </p> }
<th attr'entityAttributes> text'simpleParagraphTokens
{ if (VboxMode) emit(<hbox>); <p style="label" attr> text </p> }
<td attr'entityAttributes> text'simpleParagraphTokens
{ if (VboxMode) emit(<hbox>); <p attr> text </p> }
<tr> { </hbox> }
These are Bertrand'ish (becoming less and less... ;-), similar to my simple
list example. One new feature is introduced. The substitution on the right
is applied when the pattern on the left is matched. If there are multiple
expressions (separated with semicolons) in the substitution, the "return
value" for the substitution is the last expression. The expressions left of
the semicolon are merely evaluated for their side-effects. Please ignore
the syntax if you feel it's ugly --- I don't really care what it looks
like. (Although you might tell me why you think it's ugly. ;-)
It may be unclear what the purpose of the syntax extensions are. I think
they would only be used by people writing HTML by hand. Maybe the syntax
would be extended in a browser, maybe in an authoring tool. (If we
standardize a script language, which a lot of people would like to see, then
there's really no reason why the browser can't do it.) An HTML converter
(certainly an HTML editor) would use the plain-vanilla un-extended HTML
syntax complete with zillions of boxes and paragraphs. :-)
The previous syntax extensions enable the following table style: (strongly
modeled after Dave Raggett's current HTML+ proposal)
---------
<style>
*caption.align: center
*label.weight: bold
*table*p.align: center
*table*alignCousins: true
</style>
<table border>
<caption>A more complex table</caption>
<th>
<vbox>
<th>Average <tr>
<th id="hcol">Height <th>Weight <tr>
</vbox>
<th>Other Category <tr>
<th> Males <td cousin="hcol"> 1.9 <td> 0.003 <td> yyy <tr>
<th> Females <td> 1.7 <td> 0.002 <td> xxx <tr>
</table>
---------
Comments and criticism much appreciated.
- Ken
-- Ken Fox, fox@pt0204.pto.ford.com, (313)59-44794, KFOX on PROFS ------------------------------------------------------------------------- Ford Motor Company, Powertrain | "Is this some sort of trick question CAD/CAM/CAE Process Integration | or what?" -- Calvin AP Environment Section |