Pre-processing Docbook file contents

224 views Asked by At

I am currently using a documentation toolchain which has the following steps:

  1. Write documentation in Textile format
  2. Convert Textile documentation to Docbook ( Mylyn WikiText )
  3. Convert Docbook to PDF ( maven docbkx plugin )

I am mostly satisfied with the process, and I'd like to customise how the tables and the images are rendered in the PDF. Namely, I'd like to apply the following transformations:

  1. informaltable -> informaltable rules="all"
  2. imagedata -> imagedata scalefit="1" width="100%" contentdepth="100%"

I've already set up a custom stylesheet, but I'm not sure if or how these transformations can be performed.

How can I apply these transformations, given an existing docbook file?

1

There are 1 answers

0
AlChuck On

This is probably too late to be useful to you, but I thought I'd reply anyway. If you have an XSL stylesheet that overrides certain behaviors of the regular stylesheets (what Bob Stayton calls a "customization layer," you can simply add a line to your pom file that tells the docbkx plugin to use it. For the XHTML transformation, it's the htmlCustomization element. For example,

src/main/docbkx/custom-article-html.xsl

For PDF output it would be the foCustomization element:

src/main/docbkx/custom-article-print.xsl

The trick then is that in that customization file, you have to change your import statement to use the symbolic path that the plugin expects:

This is documented at http://docbkx-tools.sourceforge.net/advanced.html

My problem was that I was also using my own custom titlepages, which are also imported into my customization layer, and for the life of me I could not figure out how to tell the plugin where to find it. I might have been able to live with the default title page layout in my HTML output, but not for the print. I finally gave up and am now in the middle of trying the Maven XML plugin and applying the XSLT transformation directly. Once again I'm stuck, though. Once I get the fo files for the intermediate step to PDF, I can't seem to find a Maven plugin that can apply FOP to them. Actually I did find a plugin on Maven Central but I can't find any documentation of how to actually use it. Just this: http://mavenhub.com/mvn/central/org.apache.xmlgraphics/fop/1.0