Skip to content

Integration

Nico Kutscherauer edited this page Sep 30, 2024 · 3 revisions

This page describes how to integrated the XPath Model XSLT package into your project.

Using Package

To use the XSLT package in your XSLT stylesheets you just have to add the following to your XSLT stylesheets:

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:nk="http://www.nkutsche.com/xpath-model" 
    version="3.0">

    <xsl:use-package name="http://www.nkutsche.com/xpath-model" package-version="*"/>

    <!-- ... -->

</xsl:stylesheet>

This is always required. Choose one of the following integration strategies to provide the sources to Saxon.

Manual Integration

For manual integration you can just download the xpath-model-{version-nr}-src.zip from the GitHub release page or from Maven central. Unpack it and configure your Saxon to enable the package:

<configuration edition="HE" xmlns="http://saxon.sf.net/ns/configuration">
    <xsltPackages>
        <package name="http://www.nkutsche.com/xpath-model" version="{project-version}" sourceLocation="path/to/xpath-model-src/xsl/xpath-model-pkg.xsl"/>
    </xsltPackages>
</configuration>

Provide this config file to Saxon using for instance the -config parameter.

Using XSLT Package Manager and Maven

The project provides also a Maven artifact which is compatible to the XSLT Package Manager. It is published on Maven central.

Add the following dependencies to your project POM:

<dependency>
    <groupId>com.nkutsche</groupId>
    <artifactId>xpath-model</artifactId>
    <version>{project-version}</version>
</dependency>
<dependency>
    <groupId>com.nkutsche</groupId>
    <artifactId>xslt-pkg-managerXXX</artifactId>
    <version>2.0.0</version>
</dependency>

Note: Replace XXX with 100, 110 or 120 depending if you use a Saxon 10.x, 11.x or 12.x.

Add an additional CLI command -init to your Saxon call:

java -cp $classpath net.sf.saxon.Transform -init:com.nkutsche.xslt.pkg.handler.PackageManager ...

Clone this wiki locally