HTML and CSS Reference
In-Depth Information
A few examples show how this works. Consider the declaration of the
<html>
tag, taken from the HTML DTD:
<!ELEMENT html (head, body)>
This defines the element named
html
whose content is a
head
element
followed by a
body
element. Notice you do not enclose the element
names in angle brackets within the DTD; you use that notation only
when the elements are actually used in a document.
Within the HTML DTD, you can find the declaration of the
<head>
tag:
<!ELEMENT head (%head.misc;,
((title, %head.misc;, (base, %head.misc;)?) |
(base, %head.misc;, (title, %head.misc;))))>
Gulp. What on Earth does this mean? First, notice that a parameter en-
tity named
head.misc
appears several times in this declaration. Let's go
get it:
<!ENTITY % head.misc "(script|style|meta|link|object)*">
Now things are starting to make sense:
head.misc
defines a group of
elements, from which you may choose one. However, the trailing aster-
isk indicates that you may include zero or more of these elements. The
net result is that anywhere
%head.misc;
appears, you can include zero
or more
script, style, meta, link
, or
object
elements, in any order.
Sound familiar?
Returning to the
head
declaration, we see that we are allowed to begin
with any number of the miscellaneous elements. We must then make
a choice: either a group consisting of a
title
element, optional miscel-
laneous items, and an optional
base
element followed by miscellaneous