Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 27 Mar 2013

      dblatex, DocBook, acknowledgements and PDF output

      Written by Tim Bielawa

      In the book I’m working on, the Virtual Disk Guide, I recently decided to start templating out an Acknowledgements chapter. I’m writing the book in DocBook5 and my print (PDF) publishing toolchain looks like this:

      1. GNU Make
      2. xsltproc
      3. dblatex

      The problem I ran into is that dblatex has no stylesheets or templates built in to handle DocBook acknowledgements elements and the PDF is difficult to manage, but systems like sodapdf could be the perfect solution for this. Acknowledgements sections should be fairly simple to render I thought. You really just need a chapter header, and then to process the block elements, like paragraphs, blockquotes, and what have you. To me, the same template used for Colophon sections would create an ideal acknowledgements section.

      I’ve never done any real XSLT work before, and even after this I still wouldn’t claim that I have, but here’s what I did to get a working acknowledgements section:

      I found the location dblatex installs it’s XSL documents to on my system, /usr/share/dblatex/xsl, then I used grep to find files that matched colophon elements: grep colophon *.xsl. Examining the component.xsl file suggested that it had the templates I needed to copy and modify for feeding into dblatex. After a few attempts I came up with working results. Here’s what it ends up looking like:

      And you consume it with dblatex in this way:

      For an example of how this renders you can look at the PDF version of the Virtual Disk Guide. I keep the file in version control on the github project for the book.

      Speaking of Acknowledgements: Thanks to my buddy Al for dusting off his XSLT skills and debugging this with me initially.

      • Tags »

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Querying block device sizes in Python on Linux and Mac OS X February 4, 2023
      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa

    Creative Commons License
    Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.