DocBook XSLT 2.0 Stylesheets

Volume 3, Issue 17; 13 Sep 2019

A new release of the DocBook XSLT 2.0 Stylesheets is available. The primary motivation was to improve Saxon 9.9 support.

Yesterday, I pushed version 2.3.14 of the DocBook XSLT 2.0 Stylesheets. (I also pushed them to Maven if you prefer not to construct your class paths by hand.)

One of the difficulties with having an interest in many open source projects is finding the time to give them all the attention they deserve. I still plan to come back and improve the paged media output from the XSLT 2.0 stylesheets. And maybe even convert them to XSLT 3.0 at some point, but XProc 3.0 is getting most of my attention these days.

That said, DocBook is used both for the XProc specifications and also for my XML Summer School slides. And since I started using (some recent version of?) Saxon 9.9, I’ve been getting loads of err:SXWN9000 warnings.

That warning is about the use of xsl:value-of to return atomic values. Consider:

<xsl:function name="ex:give-me-five" as="xs:integer">
  <xsl:value-of select="5"/>

Technically, xsl:value-of returns a text node, so it’s a bit bogus to use it to return atomic values. You should use xsl:sequence instead. But there’s a long history of using xsl:value-of (it predates xsl:sequence by a decade or two!) and it took a couple of tries (and finally an XSLT stylesheet) to find and remove them all.

Along the way, I also:

  1. Added support for the other style in keycap. It’s not interesting or useful, but avoids an error in the test suite.
  2. Cleaned up a bunch of whitespace inconsistencies (spaces vs. tabs, linebreaks, etc.).
  3. Tinkered with the jar file manifest to make it easier to use directly on the classpath (as opposed to through Maven).
  4. Updated the Travis build to use OpenJDK8. Something more recent might be better, but this avoids class file compatibility problems for the time being.
  5. Updated the build infrastructure (version of Gradle)

Share and enjoy.