5. Using the Tools

This is a terse introduction to using the DocBook tools to compile XML documents. I won't go into the details of DocBook mark up. See DocBook: The Definitive Guide for complete information on writing DocBook markup.

5.1. A Simple DocBook XML document

Below is an example of a very simple DocBook XML document. Copy it into a text file and we'll compile it into HTML and RTF in a minute.

text.xml [as text ]

<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"

<!ENTITY version "0.01">
<!ENTITY supercopy "SUPERCOPYRIGHT &copy;&reg;">

Comments just like html


    <title>Simple XML Sample Document</title>
    <copyright><year>2001</year><holder>John Doe</holder></copyright>
      <para>This legal mumbo jumbo will stop evil. It even has &supercopy;.</para>
      <para>This is a simple XML sample version &version;. It is good for nothing but processing.</para>

    <title>About this book</title> 
      This book was hard
      work if you look at the history and momentum behind the LDP and
      DocBook and SGML and XML and....and....and...</para>
    <section><title>Copyrights and Trademarks</title> <para>Copyright
	&copy; 2001 John Doe</para>

      <para>This guide is tightly scoped with one purpose; to process.</para>


    <para>Some Hoity Toity Person</para>


5.2. Generating HTML & RTF

You can see that DocBook markup is pretty straight forward. Now let's compile this test.xml into some real LDP HOWTO style HTML. I made a directory called 'sample' to work with.

mkdir sample
cd sample
mv $DBARCHIVE/test.xml .
openjade -t xml -d $SGMLHOME/dsssl/docbook/html/ldp.dsl#html $SGMLHOME/dsssl/docbook/dtds/decls/xml.dcl test.xml

You shouldn't get any error messages. After, processing you should have the following (or similar) in the folder with test.xml

a23.html  index.html  test.xml  x20.html
c14.html  ln10.html   x17.html

To compile RTF try this

openjade -t rtf -d $SGMLHOME/dsssl/docbook/print/ldp.dsl#print $SGMLHOME/dsssl/docbook/dtds/decls/xml.dcl test.xml

Description of command line switces:

That's all there is to it. Once you figure out TeX and RTF you can convert to other popular document formats with other tools. You might use TeX, LaTeX, PDF, PDB, or even some unmentioned proprietary formats and tools. I've made my sample outputs available with this guide.