DocBook XML to PDF on Ubuntu
2007-09-12
I just looked into ESR’s DocBook Demystification HOWTO. After reading that, I wanted to try to produce PDF output from DocBook XML on my own Linux box which is running Ubuntu.
But neither of the necessary packages for this task which are mentioned in the HOWTO is in Ubuntu feisty. xmlto is there, but needs passivetex, which was in earlier Ubuntu releases, but was removed (It was removed from Debian, too.). fop is also not in Ubuntu, though it is in Debian.
But I found another package in Ubuntu: db2latex-xsl, which contains XSL stylesheets to turn DocBook XML into LaTeX with the help of a XSL processor like xsltproc. The LaTeX file can then be processed with pdflatex to produce PDF.
Here is the shell script I wrote for this:
$ cat ~/bin/db2latex
#!/bin/sh
PATH=/bin:/usr/bin
for i
do
basename=`basename "$i" .xml`
xsltproc -nonet -o "$basename.tex" \\
/usr/share/xml/docbook/stylesheet/db2latex/latex/docbook.xsl "$i"
done
Call this with db2latex foo.xml and then pdflatex foo.tex to get a PDF file foo.pdf from a source file foo.xml.
2007-10-02 at 15:07
I think the name of the package should be db2latex-xsl (latex instead of linux). Useful post – I found a publication in docbook format and this helped convert it to PDF
2007-10-02 at 17:43
Thanks Jett, I corrected the name of the package in the post.
2007-11-11 at 16:24
Bonjour,
small and good tutorial, this is exactly what i search !
Thanks
2008-12-25 at 23:19
Both xmlto and fop are available in Ubuntu 8.10.
passivetex is now part of xmltex
2008-12-26 at 17:57
Marton, thanks for the update. See also my own update post, which recomends the dblatex package.