Re: Validator and/or correct markup for empty table row

On Wed, 28 Sep 2005, Robert J. O'Hara wrote:

> On several hundred other pages 
> on which I make the claim it is true; I just discovered that on this page it 
> is false, which is why I am trying to fix it. ;-)

If I notice that some claim is not true, wouldn't it be most natural to 
remove it as the first step? _Then_ I could consider whether things can be 
changed to make it true, and restore the claim.

Yeah, I know that's not what people do with icons that claim validity.
That's one of the reasons why they are worse than useless. Even if authors 
_wanted_ to present them only when they are true, they _won't_ actually 
act that way, as a rule. When they edit a page, they don't revalidate 
after any and all changes.

>> That would be better done in CSS by setting the heights there.
>
> That is exactly what I do.

So what's the problem.

>>> So, should this be marked up in a different way,
>> 
>> Yes.
>
> And your suggestion is?

Remove the empty <tr> elements, adjusting rowspan attributes and the style 
sheet as needed.

>> A validator could not be changed to accept empty <tr>s _conditionally_,
>> to the extent that the validator is a validator, i.e. checks the syntax 
>> against a DTD, since a DTD cannot express such conditionality. That would 
>> go far beyond the simple metalanguage used when writing DTDs.
>
> But the DTD is full of conditionality. Is the markup <td>some text</td> 
> valid? It is if it is contained within a <tr></tr>, but not otherwise, and 
> even if it is contained within a <tr></tr>, the nested pair is only valid if 
> they are contained within a <table></table>.

You might call such things conditionality, but it's really a matter of 
simple nesting. The point is that in a DTD, you cannot make the content 
model of an element, such as <tr>, depend on anything outside the element

> I am getting at a deeper issue in the nature of data tables, which you aren't 
> recognizing. It seems to me this is a conceptual deficiency in the (X)HTML 
> table model

(X)HTML has a watered-down idea of the original HTML table model outlined 
in RFC 1942, which was in turn a watered-down version of a more 
sophisticated model. I wouldn't even say that HTML _has_ a table model.
It doesn't really define what a table _is_, as a data structure, and it 
babbles about "layout tables", deprecating much of them with the right 
hand while the left hand throws in fancy attributes and definitions.

> and the way <tables>s are validated;

That's even much more simplistic and limited by the structure of DTDs.
Some better tool for defining syntactic rules formally would be needed, 
but schemas don't seem to have much success in practice.

> Consider this table, which, when properly embedded in other elements, will 
> pass the vaildator:
>
> <table>
> <tr> <td></td> <td></td> <td></td> </tr>
> <tr> <td></td> </tr>
> <tr> <td></td> <td></td> </tr>
> </table>
>
> How are we to understand the data being represented here?

Validation is not about understanding anything, as a data structure.
It's pure syntax, and at a primitive level at that.

Not only will the data pass validation - it also conforms to the HTML 
specification quite nicely. Yet, the specification does not say what that 
tag sallad _means_. The best interpretation is probably that it is a
three by three table that has just one cell on the first row and two
cells on the second row, so that some cells are _missing_ from the
3 by 3 structure (really missing, as opposite to being empty).

> Unless one adds rowspan and/or colspan attributes 
> somewhere and begins to constrain what relationships are being represented, 
> the table above might mean dozens on different things

It might. The logical conclusion is that does not mean anything, i.e. it 
has no specified semantics. This is a flaw in the specification (as well 
as in a document that uses such a construct), but it has nothing to do 
with validation, or with the question whether <tr></tr> should be 
allowed.

> In a logical sense, data tables are fundamentally made up not only of rows 
> but also of columns, but the (X)HTML table model, as embodied in the DTD and 
> as verified by the validator, is only about rows.

The (X)HTML table model, to the extent that there is one, is both about 
rows and about columns, though in a rather unsatisfactory way. After all, 
there are elements and attributes specifically related to columns,
such as <col> and colspan="...". But a DTD cannot, by SGML or XML rules, 
impose requirements like "all rows must contain the same number cells".
(Actually, even the prose of HTML specifications imposes no such 
requirement. But the point is that if they did, it would not be 
formalizable in a DTD.)

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Wednesday, 28 September 2005 12:03:35 UTC