Tech Tidbits - Ruby, Ruby On Rails, Merb, .Net, Javascript, jQuery, Ajax, CSS...and other random bits and pieces.

Monday, June 4, 2007

DocBook

I've been tackling some documentation at work and decided to take a look at docbook.

There are a few good resources to start with:


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:



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:

About Me

My photo
Developer (Ruby on Rails, iOS), musician/composer, Buddhist, HSP, Vegan, Aspie.

Labels