docbook / xslTNG

DocBook xslTNG Stylesheets
https://xsltng.docbook.org
MIT License
41 stars 20 forks source link

register extension function when running within an xproc pipeline #429

Open frank-steimke opened 8 months ago

frank-steimke commented 8 months ago

Hi,

i try to use the xslTNG Stylesheets within an xproc pipeline with the recent version of xmlcalabash 1 (outside of oxygen). Seems to work, but image sizes are not correct. The docbook-xsltng.jar is part of the classpath. Maybe because the extension functions are not registered?

Is there a way to use and register extension functions when using calabash? Is it possible with the saxon HE edition that is part of the stylesheets?

Greetings, Frank

ndw commented 5 months ago

I'm quite surprised that I haven't implemented a way to do this, but a quick look around in the source code suggests that I have not :-(

In the meantime, you can do it in a Saxon configuration file with a resources element.

The resources section you need is something like this:

 <resources>
    <extensionFunction>org.docbook.xsltng.extensions.Cwd</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.ImageProperties</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.Pygmentize</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.PygmentizeAvailable</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.XInclude</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.ValidateRNG</extensionFunction>
    <extensionFunction>org.docbook.xsltng.extensions.ImageMetadata</extensionFunction>
</resources>

Bearing in mind that ImageMetadata may not initiailize successfully unless the metadata-extractor classes are also on the classpath.