Re: HTML Pro questions

Peter Flynn <pflynn@curia.ucc.ie> wrote:

> <!ELEMENT HEAD - O (TITLE & ISINDEX? & BASE? & META* & LINK* & NEXTID? &
>  BGSOUND? & SCRIPT? & NOSCRIPT? & STYLE? & RANGE*)
>  --<Title>Documentation header-->
>
> This defines exactly one TITLE plus optional everything else: ? means
> zero or one of them; * means zero or more of them. I think that's
> right, shouldn't be any need for a hack.


This content model prohibits intermingled METAs and LINKs
(<META><LINK> <META><LINK>...) -- the AND group requires that
all the META elements appear together, all the LINK elements
appear together, etc.

There are a number of conventions for metadata in HTML
(such as the Dublin Core scheme) that use intermingled
METAs and LINKs, so this is a fairly important issue.

The best solution I was able to come up with was:

	<!ENTITY % head.any 	-- repeatable HEAD elements --
		"(META | LINK | SCRIPT | STYLE | RANGE)*" >

	<!ELEMENT HEAD - -
	    ( %head.any; ,
		( (TITLE, %head.any;)
		& (BASE, %head.any;) ?
		& (ISINDEX, %head.any;) ?
		& (NEXTID, %head.any;) ?
		& (BGSOUND, %head.any;) ? ) ) >


(This might be a bitch to specify using Near&Far though :-)

Another solution, which is what Dave Raggett used for
HTML 3.2, is to make the "%head.any;" elements an
inclusion exception on the HEAD element and an
exclusion exception on TITLE, SCRIPT, and other
non-empty subelements:

	<!ENTITY % head.any 	-- same as above but no '*' --
		"(META | LINK | SCRIPT | STYLE | RANGE)" >

	<!ELEMENT HEAD - O (TITLE & BASE & ...) +%head.any; >
	<!ELEMENT TITLE - - (#PCDATA) -%head.any; >
	<!-- etc. -->


The exclusions are important; otherwise you can have

    <HEAD>
    <TITLE>blah <SCRIPT>...</SCRIPT> blah </TITLE>
    </HEAD>



--Joe English

  joe@art.com

Received on Tuesday, 5 November 1996 11:57:04 UTC