FRAMESET and BODY problem?

Paul Fidler (
Tue, 15 Jul 1997 18:16:34 +0100 (BST)

Date: Tue, 15 Jul 1997 18:16:34 +0100 (BST)
From: Paul Fidler <>
Subject: FRAMESET and BODY problem?
In-Reply-To: <>
Message-ID: <>

I've just been messing around with 'A Kinder, Gentler HTML Validator' [1]
just to see what would validate and what wouldn't with the HTML4.0 DTD [2]
and came across what may be a problem, but which may equally well be a
problem with my understanding of SGML, but I thought I'd ask anyway...

The HTML 4.0 specification for frames [3] says:

  An HTML document with frames has a slightly different makeup than an 
  HTML document without frames. A standard document has one HEAD section
  and one BODY. A document with frames has a HEAD, a FRAMESET, and an
  optional BODY. 
  The BODY section that follows the FRAMESET declaration provides
  alternate content for user agents that do not support frames or are 
  configured not to display frames.

And later, when discussing alternative content:

  User agents that do not support frames must display the BODY section
  that follows the outermost FRAMESET of a document.

From these, plus the bits of example HTML in the same document, I got the
impression that the preferred way of specifying non-frames content is now:

  <FRAME ...>
  <FRAME ...>

However when trying a test file [4] with KGV I got the error:

  Error at line 14:
          document type does not allow element "BODY" here

A revised version of the file [5] did validate, but this used the
following structure:

  <FRAME ...>
  <FRAME ...>

The HTML 4.0 DTD [2] says this about the HTML element:

  <!ENTITY % html.content "HEAD, (FRAMESET|BODY)">

  <!ELEMENT HTML O O (%html.content)>

    %i18n;                           -- lang, dir --

The 'How to read the HTML DTD' section of the spec. [6] says the following
about content model definitions:

  A | B 
    Both A and B are permitted in any order
  A , B 
    A must occur before B.

From which I understand "HEAD, (FRAMESET|BODY)" to mean a mandatory HEAD
element, followed by optional FRAMESET and BODY elements in any order,
(although [3] does go on to say:

  Elements that might normally be placed in the BODY element must not
  appear before the first FRAMESET element or the FRAMESET will be

which I assume to mean that FRAMESET should actually come before BODY).

So, my questions are:

  a) Given the above definition of the HTML element, why does my original
     example [4] not validate ?  Am I missing something ?

  b) Would a content model definition of "HEAD, FRAMESET?, BODY" be 
     better than "HEAD, (FRAMESET|BODY)" ?

  c) Should the content model for the FRAMESET element be changed to
     exclude NOFRAMES element, and the content model for the NOFRAMES
     element changed to exclude BODY ? 

     This would (I think) cause my second example [5] not to validate
     which, if this is no longer the preferred way of doing things, may be



Paul Fidler
Cambridge University Engineering Department
Trumpington Street, Cambridge, CB2 1PZ, UK