7.5. An SGML DocBook book template

DocBook books are generally for projects over 25 pages long, they allow the inclusion of chapters and parts, a template for a book is shown below:

<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook V4.1//EN'>
<book>
  <bookinfo>
    <title>Your title here</title>
      
    <author>
      <firstname>Your first name</firstname>
      <surname>Your surname</surname>
      <affiliation>
        <address><email>Your e-mail address</email></address>
      </affiliation>
    </author>
   
    <copyright>
      <year>1998</year>
      <holder role='mailto:your e-mail address'>Your name</holder>
    </copyright>
    
    <pubdate role='rcs'>$Date: 2003/01/08 10:27:39 $</pubdate>
  
    <releaseinfo>$Id: DocBookSys-Chapter7-SGML-Creating.xml,v 1.1.1.1 2003/01/08 10:27:39 ug55axm Exp $</releaseinfo>
  
    <abstract>
      <para>Include an abstract of the book&apos;s contents here.</para>
    </abstract>
  </bookinfo>
  
  <part><title>Part1</title>
    <chapter><title>Part 1, Chapter 1</title>
      <sect1><title>Part1, Chapter 1, Section1</title>
        <para>
	  Hello there!
	<para>
      </sect1> 
    </chapter>

    <chapter><title>Part 1, Chapter 2</title>
      <sect1><title>Part1, Chapter 2, Section 1</title>
        <para>
	  Hi there!
	<para>
      </sect1> 
    </chapter>
  </part>

  <part><title>Part2</title>
    <chapter><title>Part 2, Chapter 1</title>
      <sect1><title>Part 2, Chapter 1, Section1</title>
        <para>
	  GoodDay there!
	<para>
      </sect1> 

      <sect1><title>Part2, Chapter1, Section2</title>
        <para>
	  GoodNight there! 
	<para>
      </sect1> 
    </chapter>
  </part>
</book>
    

This file can be validated using onsgmls like this:

onsgmls -s booktemplate.sgml

This should produce no errors and exit silently because the document is structured correctly. RTF output can be generated like this:

openjade -t rtf -d /path/to/docbook/dbdsssl/print/docbook.dsl booktemplate.sgml

There is a DocBook element quick reference card available from http://www.dpawson.co.uk/docbook/reference.html#d3e60.