DocBookInJar is merely a demonstration of one approach to running XSLT transformations on DocBook documents "out of the JAR". That is, we don't need the stylesheets on the filesystem: they're provided as resources in the JAR. This demonstration uses:
- DocBook 1.79.2 stylesheets
- Saxon-HE 12.3
- Java 9
To demonstrate that this approach works, you can clone this repository and run:
mvn clean test
That's it. It's just a proof of concept.
The java-8
branch contains modifications to allow this demonstration
to run under Java 8. The principal difference is how the
URLStreamHandler
is provided at runtime.
- Java 9:
ClasspathURLStreamHandlerProvider
returns theURLStreamHandler
, and is registered viaMETA-INF/services
. - Java 8:
ClasspathURLStreamHandlerFactory
returns theURLStreamHandler
, and is registered via a call toURL.setURLStreamHandlerFactory()
.
The motivation for doing this is described in a post to Stack Overflow. The approach itself, provided by Jukka Matilainen, is described in this comprehensive answer, and this pull request.