Docbook is a set of XML definitions that specify the structure of every element that any simple or complex technical or non technical document can contain. It is now widely used and has become a standard. Docbook is maintained and developed by the OASIS organization.
Note: XML = eXtended Markup Language
Docboook is highly sophisticated and sometimes complex. The examples that are presented in this book only use a few number of docbook elements and yet these elements are enough to create good-looking documents.
The basic subdivisions of an XML Docbook documents are:
The <book> contents of your book </book> element is the unique and root element of a Docbook XML document.
The <chapter> contents of a chapter </chapter> element is the first subdivision in a book. A book usually contains several chapters. Every chapter must have a title.
The <section> contents of a section </section> element is the first subdivision in a chapter. A chapter can contain one section, several sections or none. Every section must have a title.
The <para> contents of a paragraph</para> element is a subdivision anywhere in a chapter or section. Paragraphs break the text into smaller parts and make the book easier to read.
Some additional useful elements are:
The <preface> contents of a preface </preface> The preface is particularly useful in PDF formats.
The <bookinfo> information about the book </bookinfo> element is useful with Epubs as it can be used to generate a cover page.
The <title> of a book, chapter or section </title> Titles are formatted with a bigger font so that they stand out and clearly indicate the beginning of a chapter or a section. They are also used to build the Table of Contents where appropriate.
These elements are powerful enhancers of the reader's experience:
The <mediaobject> picture definition </mediaobject> inserts a picture.
The <itemizedlist><listitem> items of a list </listitem></itemizedlist> structures generate nice bulleted lists.
The <emphasis> italic text </emphasis> element specifies where to show text in italic.
The <programlisting> any number of lines </programlisting> within CDATA indicates the embedded text should appear as an excerpt of a program.
In addition to the XML definitions a set of free stylesheets in XSL format have been developed in order to print and produce HTML documents from Docbook XML sources. As more output formats were needed more stylesheets have been created. This set of stylesheets also known as Docbook XSL is now maintained by the SourceForge community.
Note: XSL = eXtended Stylesheet Language
The Docbook XSL package is a set of collections, each collection targeting a specific output format. The Docbook XSL package consists of a number of folders, each folder containing a mix of xml, xsl, css and images that a transformer will use as models to build the final document.
The transformers usually accept a number of parameters that modifify how they operate. These parameters can be changed in the script that invokes the transformers.
The stylesheet themselves - the xsl files - allow for some user customization. Alternative xsl files can be loaded to override the original xsl files contents or modifications can be brought to the xsl files. In this book we use the second method, which is a good choice when changes are permanent and relatively small.