204 lines
4.1 KiB
HTML
204 lines
4.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Document Type Definitions</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="DocBook Demystification HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Structural markup: a primer"
|
|
HREF="x69.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Other DTDs"
|
|
HREF="x120.html"></HEAD
|
|
><BODY
|
|
CLASS="sect1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>DocBook Demystification HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x69.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x120.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="sect1"
|
|
><H1
|
|
CLASS="sect1"
|
|
><A
|
|
NAME="AEN97"
|
|
></A
|
|
>4. Document Type Definitions</H1
|
|
><P
|
|
>(Note: to keep the explanation simple, most of this
|
|
section is going to tell some lies, mainly by omitting a lot of
|
|
history. Truthfulness will be fully restored in a
|
|
<A
|
|
HREF="sgml.html"
|
|
>following section</A
|
|
>.)</P
|
|
><P
|
|
>DocBook is a structural-level markup language. Specifically, it
|
|
is a dialect of XML. A DocBook document is a hunk of XML that uses
|
|
XML tags for structural markup.</P
|
|
><P
|
|
>In order for a document formatter to apply a stylesheet to your
|
|
document and make it look good, it needs to know things about the
|
|
overall structure of your document. For example, it needs to know
|
|
that a book manuscript normally consists of front matter, a sequence
|
|
of chapters, and back matter in order to physically format chapter
|
|
headers properly. In order for it to know this sort of thing, you
|
|
need to give it a <I
|
|
CLASS="firstterm"
|
|
>Document Type
|
|
Definition</I
|
|
> or DTD. The
|
|
DTD tells your formatter what sorts of elements can be in the document
|
|
structure, and in what orders they can appear.</P
|
|
><P
|
|
>What we mean by calling DocBook an `application' of XML is
|
|
actually that DocBook is a DTD — a rather large DTD, with
|
|
somewhere around 400 tags in it.</P
|
|
><P
|
|
>Lurking behind DocBook is a kind of program called a
|
|
<I
|
|
CLASS="firstterm"
|
|
>validating parser</I
|
|
>.When you format a DocBook document, the
|
|
first step is to pass it through a validating parser (the front end of
|
|
the DocBook formatter). This program checks your document against the
|
|
DocBook DTD to make sure you aren't breaking any of the DTD's
|
|
structural rules (otherwise the back end of the formatter, the part
|
|
that applies your style sheet, might become quite confused).</P
|
|
><P
|
|
>The validating parser will either bomb out, giving you error
|
|
messages about places where the document structure is broken, or translate
|
|
the document into a stream of <I
|
|
CLASS="firstterm"
|
|
>formatting events</I
|
|
>
|
|
which the parser back end combines with the information in your stylesheet
|
|
to produce formatted output</P
|
|
><P
|
|
>Here is a diagram of the whole process:</P
|
|
><DIV
|
|
CLASS="mediaobject"
|
|
><P
|
|
><IMG
|
|
SRC="figure1.png"></P
|
|
></DIV
|
|
><P
|
|
>The part of the diagram inside the dotted box is your formatting
|
|
software, or <I
|
|
CLASS="firstterm"
|
|
>toolchain</I
|
|
>. Besides the obvious and
|
|
visible input to the formatter (the document source) you'll need to
|
|
keep the two `hidden' inputs of the formatter (DTD and stylesheet) in
|
|
mind to understand what follows.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x69.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x120.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Structural markup: a primer</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Other DTDs</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |