There are a few good resources to start with:
- DocBook.org the home of "DocBook: The Definitive Guide" by Norman Walsh and Leonard Muellner (published by O'Reilly & Associates, Inc.), the official documentation for DocBook.
- "DocBook XSL: The Complete Guide" by Bob Stayton.
- Single-Source Publishing with DocBook XML by Dan York.
With DocBook, you can use SGML (Dsssl styesheets) or XML (XSL stylesheets). I've chosen to work with XML. "DocBook XSL" provides the details of all the tools that are needed. At the moment I'm working on a Mac laptop, using the following:
- DocBook DTD: The DTDs can be found at http://www.oasis-open.org/docbook/xml/. I downloaded
version 4.5 (docbook-xml-4.5.zip). - DocBook XSL Stylesheets: The XSL stylesheets can be downloaded from http://sourceforge.net/project/showfiles.php?group_id=21935. I downloaded docbook-xsl 1.72.0.
- XSL processor: xsltproc (already installed on my system). There are a few others as well (Saxon, Xalan).
I installed everything in my home directory and worked from there, but LSB proposal is:
- DTD: /usr/share/sgml/docbook/xml-dtd-4.5
- XSL: /usr/share/sgml/docbook/docbook-xsl-1.72.0/
Create a DocBook XML file (book.xml, for example)
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5/EN"
"/path/to/dtd/docbook-xml-4.5/docbookx.dtd">
<book>
<bookinfo>
<title>My Book Title</title>
</bookinfo>
<chapter>
<title>Chapter Name</title>
<para>Some text</para>
</chapter>
</book>
Procss to generate html:
$ xsltproc --output book.html /path/to/docbook-xsl-1.72.0/html/docbook.xsl book.xml
You can validate XML using xmllint (parser won't necessarily do it).
$ xmllint --noout book.xml
No output will be seen unless there is an error.
I haven't covered other formats (like converting to pdf using FOP), Java parsers, catalogs, makefiles, and Ant.
Speaking of Ant, here's a resource for DocBook and Ant:
DocBook and Ant.
I've already started looking at using Cocoon with DocBook, but that will be material for another post...
No comments:
Post a Comment