XML DocBook tools

Charles Mauch cmauch at taclug.org
Sun Jul 17 02:51:38 UTC 2005


Greetings from Tacoma, WA, USA, home of the future Tacoma Spire, Ali!
On Sunday, July 17, in the 2005th year of our Lord, you wrote:

> May I know what would be the suggested tools for processing 
> XML (DocBook)? Are those tools in main or universe? 
> If those tools exist, could you please inform me, how to 
> use them?

Docbook can take a little work to get working 'your way'.  There are a lot
of guides on docbook, but for XML docbook, the two documents I return to
time and time again are:

The Official Oasis Document Reference
http://www.oasis-open.org/docbook/documentation/reference/html/docbook.html

DocBook XSL: The Complete Guide by Bob Stayton
http://www.sagehill.net/docbookxsl/index.html

I use is xsltproc (apt-get install xsltproc docbook-xsl).  Once you get it
installed, download the official docbook dtd's so you can compile your site
without an internet connection.  I use Docbook 4.4
(http://www.oasis-open.org/docbook/xml/4.4/docbook-xml-4.4.zip).  Unpack it
into a work directory.

Begin your xml document like so:

<?xml version='1.0'?>
<!DOCTYPE book SYSTEM "/home/cmauch/doc/WWW/docbook-4.4/docbookx.dtd" [
]>
<book>
<chapter><title>...</title>
..... and on
</chapter
</book>

of course, fix the path to where you unziped the dtds. :)

Then write some sample text.  When your done, you can convert the resulting
xml into html by doing something like this:

xsltproc --output filename.html \
 /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl filename.xml

This will create filename.html, from the source document filename.xml,
using the generic docbook stylesheet.  If you want to break your html
document up into a bunch of pieces, use html/chunk.xsl instead.

> E.g. I would like to process file "example.xml" to "example.pdf"; 
> how exactly would be the ubuntu's command lines?

Proper PDF conversion is a PITA using latex I've discovered.  The old
"route" was to convert your xml into tex, then use pdflatex to convert the
result to pdf.  I spent a couple of hours trying to figure out why ubuntu
spit out everything in the french language, so I gave up and switched to
apache fop (which does an AWESOME job).

http://xml.apache.org/fop/

There is a setup guide at
http://www.sagehill.net/docbookxsl/InstallingAnFO.html

Unfortunatly, installing FOP is the hard part.  Once you've got it working,
simply generate a .fo output, and then run it through fop.  eg:

xlstproc --output filename.fo .....nwalsh/fo/docbook.fo filename.xml
fop.sh filename.fo filename.pdf 

I hope that helps a little.  Spend some time reading Bob Stayton's book (or
buy it!) and it should make a lot more sense.  If you get stuck, feel free
to email me off-list or catch me on irc.  I usually go by xterminus on
irc.freenode.net.

-- 
Take it easy, [cmauch at taclug.org]

Charles Mauch, FSF Apologist, Debian/Ubuntu/Gentoo user, etc.
Every message PGP or S/MIME signed to verify authenticity.
-------------------------------------------------------------
Playing "Knives Out" by Radiohead (Amnesiac)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050716/e9d8d712/attachment.sig>


More information about the ubuntu-users mailing list