Re: FIELDSET, LEGEND, HTML, & XHTML

Christian Wolfgang Hujer <Christian.Hujer@itcqis.com> wrote:

> Am Freitag, 8. Februar 2002 18:36 schrieb Joe Kaczmarek:
> > First the question:
> > Why does HTML validation require a LEGEND for FIELDSET, while XHTML
> > validation does not?
> The definition of fieldset is indeed quite relaxed in XHTML 1.0 Strict:
> <!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
> The same applies to XHTML 1.0 Transitional:
> <!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
> 
> While this is the definition of fieldset in HTML 4.01 Strict:
> <!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
> And this is the definition of fieldset in HTML 4.01 Transitional, again the 
> same:
> <!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
		<snip/>
> This is obviously either an undocumented change in the semantics and 
> behaviour of fieldset or just a bug (typo: | instead of ,).

This is one of several places where XHTML 1.0 cannot approximate
the definition of HTML 4.01 due to the difference between SGML and
XML.  XML doesn't allow the content model like the FIELDSET content
model in HTML 4.01, so in order to approximate the definition, XHTML
1.0 had to loosen the content model.

The FIELDSET content model was already a thorny one in HTML 4.01, as
noted in a comment just above the element type declaration of FIELDSET:

<!--
  #PCDATA is to solve the mixed content problem,
  per specification only whitespace is allowed there!
 -->

And in XHTML 1.0 DTDs, there is also a comment as follows:

<!--
  The fieldset element is used to group form fields.
  Only one legend element should occur in the content
  and if present should only be preceded by whitespace.
-->

So the semantics hasn't changed, but the XHTML 1.0 DTDs cannot
enforce this restriction due to the limitation of XML 1.0.  XML
Schema could cope with this problem better, though.

Regards,
-- 
Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium

Received on Tuesday, 12 February 2002 14:02:25 UTC