Introduction to XHTML: Document Type Definitions
February 2, 2000
A
Document Type Definition
(DTD)
is used by SGML applications, e.g. HTML,
to specify rules that apply to the markup of documents
of a particular type,
including a set of element and entity declarations.
An XHTML DTD describes in precise, computer-readable language the
allowed syntax or grammar of XHTML markup.
Validating an XHTML document's content involves checking its markup
against a DTD and reporting markup errors.
You can validate HTML, XHTML, and CSS files by using the W3C's
validator;
an easy way is to include a link to
http://validator.w3.org/check/referer
in your document - click on it to validate the document.
When an XHTML document is created,
the DTD to which it conforms is declared in a document type
declaration at the top of the document.
Each DTD may be recognized by a unique label called a
formal public identifier, or FPI.
The literal (ie., quoted) text following
the word "PUBLIC" is an FPI referring to the W3C's XHTML 1.0 DTD.
XHTML 1.0 specifies three XML
document types that correspond to the three HTML 4.0 DTDs:
Strict, Transitional, and Frameset.
(Note that the DOCTYPE lines below are
broken in parts only to prevent the examples from being too wide for
non-horizontal scrolling - you can keep it all on one line).
XHTML 1.0 Strict
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
Use this when you want really clean markup,
free of presentational clutter.
Use this together with Cascading Style Sheets.
XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
Use this when you need to take advantage of HTML's presentational
features because many of your readers don't have the latest browsers
that understand Cascading Style Sheets.
XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Frameset//EN"
"DTD/xhtml1-frameset.dtd">
Use this when you want to use HTML Frames to partition the browser
window into two or more frames.
The W3C is working on replacing DTDs in XML with something called
XML Schemas.
Introduction to XHTML: Extensible Markup Language
Introduction to XHTML, with eXamples
Introduction to XHTML: Differences with HTML 4.
|