General

Components

Community

Development

TDF

ODF XSLT Runner Task

Apply XSLT stylesheets to ODF documents with Ant

ODF XSLT Runner Task is a task definition for Apache Ant which allows to apply XSLT stylesheets to ODF documents similar to Ant's build-in <xslt> task. It is based on ODFXSLTRunner. Please see ODFXSLTRunner for further details of its operation.

Getting and building ODFXSLTRunnerTask

odfxsltrunnertask is build by a NetBeans project. After you have checked out the odf-xslt-runner-task-src/show, you can open the project in NetBeans and build odfxsltrunnertask.

A binary release of odfxsltrunnertask.jar is available in the download section.

Building and running odfxsltrunner.jar requires additional jar files. Please see Requirements for details.

Usage

To use odfxsltrunner.jar with Ant, you have to include the following task definition into your buildfile, where <path> has to be replaced with the path where you have stored the odfxsltrunnertask.jar and odfxsltrunner.jar files:

     <taskdef name="odfxslt" classname="odfxsltrunnertask.ODFXSLTRunnerTask"
         classpath="<path>/odfxsltrunnertak.jar:<path>/odfxsltrunner.jar"/>

You can use this task definition on the top level (that is as a child element of the &lt;project&gt; element or locally within a single &lt;target&gt; element. It defines a new task &lt;odfxslt&gt; which allows to process ODF documents with XSLT stylesheets.

The new task supports the use of nested &lt;param&gt; and &lt;factory&gt;elements which have the same meaning as the &lt;param&gt; and &lt;factory&gt; child elements of the &lt;xslt&gt; task.

Parameters

Attribute Description Required
in specifies an ODF document to which the stylesheet is applied. Yes, unless infile has been specified
infile specifies a plain XML document to which the stylesheet is applied. Yes, unless in has been specified
out specifies an ODF document to which the result of the transformation is stored.
Unless template has been specified, the package specified by in is copied to out, and the stream specified by path is replaced with the result of the transformation.
Yes, unless outfile has been specified
outfile specifies a plain XML document to which the result of the transformation is stored. Yes, unless out has been specified
path Specifies the stream within the ODF packages specified by in and out, which is the source or target of the transformation. No
template Specifies that the specified stream within the out ODF package is replaced with the result of the transformation, without previously copying the package specified by in. The specified out package must exist. No: Default is "content.xml"
force Specifies that the target file shall be recreated, even if it is newer than the source file or the stylesheet. No: Default is false

Parameters specified as nested elements

Param

Param specifies a parameter that is passed as XSLT parameter to the XSL stylesheet.

Parameters

Attribute Description Required
name name of the parameter. Yes
expression value of the parameter. Note: All parameter values are passed as string values to the XSLT parameters specified by `<xslt:param>` elements within the stylesheet. Yes

Note: The parameters if and unless which are supported by the &lt;xslt&gt; task are (not yet) supported.

Factory

Factory specifies Java TransformerFactory class to use.

Parameters

Attribute Description Required
name full qualified TransformerFactory class name. Yes

Requirements

odfxsltrunnertask requires Java 5, or a later version of Java.

It further requires ODFXSLTRunner and the corresponding ODFDOM component.

Note: When building odfxsltrunertask, the odfxsltrunner project has be checked out, too. It is build automatically.

In the Ant task definition, the classpath attribute must include the odfxsltrunnertask.jar and odfxsltrunner.jar files. The ODFDOM jar file is found automatically if it is located in a folder called lib next to the odfxsltrunner.jar file.

Impressum (Legal Info) | Privacy Policy (Datenschutzerklärung) | Statutes (non-binding English translation) - Satzung (binding German version) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Apache License, v2.0. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License v2.0. “LibreOffice” and “The Document Foundation” are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy. LibreOffice was based on OpenOffice.org.