Rendering footnotes in tables and lists with FOP

March 7, 2008 by rvdb

[...or skip the discussion and just download the files]

The reason

During the past couple of years, I’ve gathered some experience working with XML and related standards (XSLT, XSL-FO, XQuery). Part of our professional document production chain involves rendering PDF output from XML sources. I’ve grown into a big fan of Apache’s open source FOP processor since its now ancient version 0.20.5. Although the FOP code has been substantially revised and improved long since, these recent versions are haunted by one serious bug, which kept me from switching to an up-to-date version of FOP (currently, version 0.95): footnotes inside lists or table cells get swallowed in PDF output.

On the other hand, FOP’s XSL-FO compliance rate has risen substantially in the recent versions, prompting me to find a way of dealing with this nasty show-stopper. Of course, I hope the FOP developers will be able to resolve this issue soon. In the mean time, I think I’ve found a way of circumventing (or at least alleviating) the problem (at stylesheet level; not at Java code level). Moreover, I think this approach might help other users as well, and other users might help improving this approach where it doesn’t.

Hence this initial blog post, in a mild blend of self-documentation and altruism. It will be quite technical and specific, but I hope to get the message clear. At least I’ll try, by:

  • starting from a stable, simple example. For (my own) convenience’s sake, I’ve crafted a TEI P5 example structure, since that’s where my expertise lies.
  • illustrating intermediate steps with (pointers to) XSL-FO code examples
  • illustrating the results with screenshots of corresponding PDF output of the examples

I’ve categorised this blog post under XML, XSL-FO, and XSLT as well. Although I’ll focus on the (theoretical) XSL-FO side of a solution, I’ll provide a link to a zip package containing sample XML documents and an XSLT stylesheet illustrating the final stage of this solution. However, some problems remain for which I don’t have an immediate solution. Therefore I welcome any comments.

Read the rest of this entry »