DocBook XML to PDF on Ubuntu


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


for i
    basename=`basename "$i" .xml`
    xsltproc -nonet -o "$basename.tex" \\
    /usr/share/xml/docbook/stylesheet/db2latex/latex/docbook.xsl "$i"

Call this with db2latex foo.xml and then pdflatex foo.tex to get a PDF file foo.pdf from a source file foo.xml.


5 Responses to “DocBook XML to PDF on Ubuntu”

  1. Jett Says:

    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

  2. roerd Says:

    Thanks Jett, I corrected the name of the package in the post.

  3. redacteur Says:


    small and good tutorial, this is exactly what i search !


  4. Marton Kadar Says:

    Both xmlto and fop are available in Ubuntu 8.10.
    passivetex is now part of xmltex

  5. roerd Says:

    Marton, thanks for the update. See also my own update post, which recomends the dblatex package.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

%d Bloggern gefällt das: