5. Using the Tools

This is a terse introduction to using the DocBook tools to compile sgml 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 sgml document

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

test.sgml [text]

<!DOCTYPE book PUBLIC "-//OASIS//DTD docbook sgml V4.2//EN" 
 <!ENTITY version "0.01">

Comments just like html


    <title>Simple XML Sample</title>
    <copyright><year>2002</year><holder>John Doe</holder></copyright>
      <para>This legal mumbo jumbo will stop evil.</para>
      <para>This is Simple XML Sample version &version;. It is good for nothing but processing.</para>

    <title>About this book</title> 
      This book was not hard.
    <title>Copyrights and Trademarks</title>
    <para>Copyright &copy; 2002 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 and RTF

You can see that DocBook markup is simple. Now let's compile this test.sgml into linux doc project style HTML.

openjade -t sgml -d $SGMLHOME/dsssl/html/ldp.dsl#html test.sgml

After, processing you should have the following (or similar) in the folder with test.sgml. Look at index.html in a web browser.

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

Try compiling RTF using the following. Examine test.rtf in your word processor.

openjade -t rtf -d $SGMLHOME/dsssl/docbook/print/ldp.dsl#print test.sgml

Here's a description of the 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.