Re: Body start tag.

Arnaud Le Hors (lehors@w3.org)
Wed, 16 Jul 1997 16:24:39 +0200


Message-ID: <33CCD9A7.19EE0ECD@w3.org>
Date: Wed, 16 Jul 1997 16:24:39 +0200
From: Arnaud Le Hors <lehors@w3.org>
To: www-html@w3.org
Subject: Re: Body start tag.

Alright, I can understand that more than one gets confused by this whole
thing. Beware that no decision has been made yet on this issue. But I'm
going to try and let you know what the problem really is. 


Paul Prescod wrote:
> 
> E. Stephen Mack wrote:
> > It comes as a shock to me.  Why then does global.html say:
> >
> > > <!ELEMENT BODY O O  (%block) -(BODY) +(INS|DEL)>
> > > Start tag: optional, End tag: optional
> >   ^^^^^^^^^^^^^^^^^^^
> > Here the start tag is declared to be optional.
> 
> It is either:
> 
>         a) just a mistake.

No, it's not. The current DTD (not the spec) is designed to allow the
following:

1) In a frameset document:

* have FRAMESET in place of BODY
* allow NOFRAMES inside a FRAMESET as an alternate container
* have BODY inside NOFRAMES

2) In a "normal" document (not containing a FRAMESET, but possibly used
within a frameset):

* have a BODY
* allow NOFRAMES inside BODY to be used in as an alternate container -
in this case BODY is not allowed of course


I won't list here all the reasons for trying to achieve these particular
goals. But as you've noted this has the drawback of making the BODY
start tag mandatory in "normal" documents. Note that however it can
still be omitted in NOFRAMES which is why the definition of BODY has not
been changed.


>         b) non-intuitive but correct: If there *were* a case where <BODY> was
> *required* then it would be optional
> 
> > The HTML element must contain a HEAD element, plus either
> > a FRAMESET elment or a BODY element.  However, the FRAMESET's
> > start tag is required.  Shouldn't the presence of PCDATA
> > imply the BODY element's beginning?  If there's no explicit
> > <FRAMESET> and no explicit <BODY>, PCDATA should imply the
> > presence of the optional <BODY> start tag.
> 
> SGML parsers are not required to do a depth-first search of the DTD.
> SGML simply has a few simple rules for allowing tags to be left off. One
> of them is that if an element is *contextually required* and is declared
> to have omissable start tags, then the tags can be left off.

You also need to have some content or the SGML parser won't infer the
omitted start tag.

> > Am I wrong?  Is the KGV in error here, or does the HTML 4.0 DTD
> > really now *require* that the <BODY> tag be present?
> 
> The latter. FRAMESET is badly designed.

But it's already out there and we need to specify it in a way which is
compatible with existing practice.
-- 
Arnaud Le Hors - W3C, User Interface Domain - www.w3.org/People/Arnaud