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.
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.
<?xml version="1.0" encoding='ISO-8859-1'?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ <!ENTITY version "0.01"> <!ENTITY supercopy "SUPERCOPYRIGHT ©®"> ]> <!-- Comments just like html --> <book> <bookinfo> <title>Simple XML Sample Document</title> <author> <firstname>John</firstname> <surname>Doe</surname> </author> <copyright><year>2001</year><holder>John Doe</holder></copyright> <legalnotice> <para>This legal mumbo jumbo will stop evil. It even has &supercopy;.</para> </legalnotice> <abstract> <para>This is a simple XML sample version &version;. It is good for nothing but processing.</para> </abstract> </bookinfo> <chapter> <title>About this book</title> <para> 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 © 2001 John Doe</para> </section> <section><title>Purpose/Scope</title> <para>This guide is tightly scoped with one purpose; to process.</para> </section> </chapter> <appendix><title>References</title> <para>Some Hoity Toity Person</para> </appendix> </book>
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:
-t backend to use (fot|rtf|tex|mif|sgml|xml)
-d style sheet to use
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.