A slightly more complex example

Let us add some body to the trivial example. The beefed–up example begins to demonstrate how exaggeratedly strict you should be when you write your documents. If this makes you nervous, the chapter called Concepts will try to reassure you that it is a good thing to do(TM).

Example 2. Fleshier DocBook document — the source

<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
]>
<book>
  <bookinfo>
    <date>1997-10-11</date>
    <title>My first booklet</title>
    <subtitle>it even has a subtitle</subtitle>
    <authorgroup>
      <author>
        <firstname>Joe</firstname>
        <othername>“dude”</othername>
        <surname>Smith</surname>
      </author>
    </authorgroup>
    <copyright>&cygnus-copyright;</copyright>
    <legalnotice> &cygnus-legal-notice; </legalnotice>
  </bookinfo>
  <toc></toc>
  <chapter id="my-first-chapter">
    <title>My first chapter</title>
    <para>Here's a paragraph of text because it is stylistically
        poor to start a section right after the chapter
        title.</para>
    <sect1 id="my-first-chapter-a-section">
      <title>A section in that first chapter</title>
      <titleabbrev>A section</titleabbrev>
      <para>All I need is a single paragraph of text to make the
        section valid.</para>
    </sect1>
  </chapter>
  <appendix id="Remaining-details">
    <title>Remaining details</title>
    <para>Although this booklet is quite complete, here I will
        mention some details I never got to.</para>
    <sect1 id="Use-of-the-word-dude">
      <title>Use of the word dude</title>
      <para>Here's an example of how to say
        <emphasis>dude</emphasis>: DUDE.</para>
      <caution>Saying dude too often can make your brain
        soft.</caution>
    </sect1>
  </appendix>
</book>
      

Brief explanation

You will noticed that I added several new elements in the document preamble (the bookinfo element). A lot of the information in bookinfo is meta-information, mostly to be used for classification and indexing, and which might or might not appear when the document is rendered.

I introduced some entities (sort of like C preprocessor macros) such as &cygnus-copyright;. These are supplied by someone else, and you should use them to get up to date boiler plate information in your document, such as the copyright statement and the legal notice.

I also added attributes to some of the elements, for example in the tag

	<chapter id="my-first-chapter">
      

An element's attributes allow you to pigeonhole extra information that may be useful when that element is processed. In this case, the id attribute identifies the chapters or sections for possible future cross–referencing.