Re: Minimized P valid XHTML?

Osmo Saarikumpu wrote:
> >From: "Bertilo Wennergren" <>
> >The XML recommendation should set you straight:
> >
> >   Empty-element tags may be used for any element which has no content,
> >   whether or not it is declared using the keyword EMPTY. For
> >interoperability,
> >   the empty-element tag should be used, and should only be used, for
> >elements
> >   which are declared EMPTY.
> >
> ><>
> Well, it certainly clears my problem by narrowing and it to an exact
> question. So, to clarify:
> a) according XML 1.0 <colgroup /> is valid (may be used)
> b) according to XHTML 1.0 <colgroup /> is not valid (must not be used)
> and the question: which recommendation rules for a xhtml 1 Transitional
> document?

Clearly, the XHTML recommendation rules for an XHTML document.  However,
as an editor of this and subsequent XHTML recommendations, my opinion is
that you are misinterpreting what you are reading.  Section 4 attempts
to explain the differences between SGML and XML and how those
differences may effect your documents.  Section 4.3 only tries to
explain that you need to close non-EMPTY elements that are opened.

However, the example you cite is somewhat weird.  While the colgroup
element COULD be empty, it makes little sense to use it that way. The
colgroup element groups columns together and defines common attributes
of those columns.  Having it empty seems a little twisted.

This is beside the point.  The XHTML 1 Recommendation makes NO
constraint on how non-EMPTY elements are used in documents.  It attempts
to explain how the XML constraints differ from those of SGML.  The XHTML
1 Recommendation does, in section 4.6, specify that elements with EMPTY
content models must have a closing tag or use the closing element
short-hand <element/> (an XML-extension). 

Beyond this, Appendix C talks about how to construct valid XHTML 1.0
documents that are compatible with existing browsers. Section C.2 talks
about Empty Elements.  It recommends that you use <br /> instead
<br></br> so that it works in existing browsers.  Section C.3 talks
about minimization.  For elements whose content model is NOT empty (like
the colgroup element), we recommend that you use <colgroup></colgroup>
instead of <colgroup/> for compatibility. An empty paragraph element
might be a more interesting example. XHTML 1.0 permits this to be
specified as <p/>. For backward compatibility with earlier browsers, you
should use <p></p> instead.

I hope this helps.

Received on Saturday, 31 March 2001 11:22:14 UTC