The term “chapter file” as used here applies to files that contain chapters, but also to those that contain a preface or appendix. All appear at the same level in a table of contents.
Chapter files have an XML declaration and a
DOCTYPE
declaration that contains references
to XML entity files, just like the main document. The root
element should be appropriate for the file content (either
<preface>
,
<chapter>
, or
<appendix>
), and the root element named
in the DOCTYPE
must match. For example, a
file that contains an appendix might begin like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
... references to entity files ...
]>
<appendix id="restrictions">
...
The file then continues with its title and all the other elements that make up its content (paragraphs, tables, lists, and so forth).
All levels below the preface/chapter/appendix level are
sections, written using <section>
elements. Nested sections also use
<section>
. Here is an example of how to
nest sections within a chapter:
<chapter> <section> (This is a section) <section> (This is a subsection) <section> (This is a subsubsection) </section> </section> </section> <section> (This is a section) </section> </chapter>
We don't use the <sect1>
through
<sect6>
elements because
<section>
can be handled more flexibly.
For example, it's easier to promote or demote a section a level
when all sections use the <section>
tag
rather than numbered section tags. Also, there is no limit to
the depth of <section>
element nesting.
Chapter files are “standalone.” That is, they are well-formed XML files, even if not included into the main document. Among other things, this means you can validate a chapter file separately, and you might generate output using just a particular chapter file (not the entire document). For example, we could create a PDF version of just the Cluster chapter from the Reference Manual.