<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2008-10-19T03:48:25Z</created-at>
  <description>Reverted to revision #2</description>
  <id type="integer">60</id>
  <name>ODFXSLTRunnerTask</name>
  <number type="integer">13</number>
  <person-id type="integer">2</person-id>
  <text>__TOC__

== Apply XSLT stylesheets to ODF documents with Ant ==
'''ODFXSLTRunnerTask''' is a task definition for [http://ant.apache.org/ Ant] which allows to apply XSLT stylesheets to ODF documents similar to Ant's build-in &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; [http://ant.apache.org/manual/CoreTasks/style.html task].

== Getting and building ODFXSLTRunnerTask ==

'''odfxsltrunnertask''' is build by a NetBeans project. After you have checked out the [http://odftoolkit.openoffice.org/source/browse/odftoolkit/tools/odfxsltrunnertask/ sources], you can open the project in [http://www.netbeans.info/downloads/index.php NetBeans] and build '''odfxsltrunnertask'''.

A binary release of '''odfxsltrunnertask.jar''' is [http://odftoolkit.openoffice.org/files/documents/254/4289/odfxsltrunnertask.jar available here].

Building and running '''odfxsltrunner.jar''' requires additional jar files. Please see [[#Requirements|Requirements]] for details.

== Usage ==

To use '''odfxsltrunner.jar''' with Ant, you have to include the following [http://ant.apache.org/manual/CoreTasks/taskdef.html task definition] into your buildfile, where ''&lt;tt&gt;&amp;lt;path&amp;gt;&lt;/tt&gt;'' has to be replaced with the path where you have stored the '''odfxsltrunnertask.jar''' and '''odfxsltrunner.jar''' files:

 
 &amp;lt;taskdef name=&quot;odfxslt&quot; classname=&quot;odfxsltrunnertask.ODFXSLTRunnerTask&quot; classpath=&quot;''&amp;lt;path&amp;gt;''/odfxsltrunnertak.jar:''&amp;lt;path&amp;gt;''/odfxsltrunner.jar&quot;/&amp;gt;
 

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

The new task supports the use of nested &lt;tt&gt;&amp;lt;param&amp;gt;&lt;/tt&gt; elements which have the same meaning as the &lt;tt&gt;&amp;lt;param&amp;gt;&lt;/tt&gt; child elements of the &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; [http://ant.apache.org/manual/CoreTasks/style.html task].

== Parameters ==

&lt;table border=&quot;border&quot;&gt;
&lt;tr&gt;&lt;th&gt;Attribute&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Required&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;in&lt;/td&gt;&lt;td&gt;specifies an ODF document to which the stylesheet is applied.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless infile has been specified&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;infile&lt;/td&gt;&lt;td&gt;specifies a plain XML document to which the stylesheet is applied.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless in has been specified&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;out&lt;/td&gt;&lt;td&gt;specifies an ODF document to which the result of the transformation is stored.&lt;br/&gt;
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.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless outfile has been specified&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;outfile&lt;/td&gt;&lt;td&gt;specifies a plain XML document to which the result of the transformation is stored.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless out has been specified&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;path&lt;/td&gt;&lt;td&gt;Specifies the stream within the ODF packages specified by in and out, which is the source or target of the transformation.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;template&lt;/td&gt;&lt;td&gt;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.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No:  Default is &quot;content.xml&quot;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;force&lt;/td&gt;&lt;td&gt;Specifies that the target file shall be recreated, even if it is newer than the source file or the stylesheet.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No: Default is false&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

== Parameters specified as nested elements ==

=== Param ===

Param specifies a parameter that is passed as [http://www.w3.org/TR/1999/REC-xslt-19991116#top-level-variables XSLT parameter] to the XSL stylesheet.

==== Parameters ====

&lt;table border=&quot;border&quot;&gt;
&lt;tr&gt;&lt;th&gt;Attribute&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Required&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;name&lt;/td&gt;&lt;td&gt;name of the paramter.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;expression&lt;/td&gt;&lt;td&gt;value of the paramter.
'''Note:''' All parameter values are passed as string values to the XSLT paramters specified by &lt;tt&gt;&amp;lt;xslt:param&amp;gt;&lt;/tt&gt; elements within the stylesheet.
&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

'''Note:''' The paramters &lt;tt&gt;if&lt;/tt&gt; and &lt;tt&gt;unless&lt;/tt&gt; which are supported by the &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; task are (not yet) supported.

== Requirements ==

'''odfxsltrunnertask''' requires [http://java.sun.com/javase/downloads/index.jsp J2RE 5], or a later version of Java. 

It further requires [[ODFXSLTRunner]] and [http://odftoolkit.openoffice.org/servlets/ProjectDocumentList?folderID=759&amp;expandFolder=759&amp;folderID=771 ODFDOM] (at least version  v0.6.1). 

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

In the Ant task definition, the '''classpth''' 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. 

'''Note:''' [[ODFDOM]] v0.6.1  requires [http://xml.apache.org/dist/xerces-j/ Apache's xerces]. The jar file '''xercesImpl.jar''' also must exist in a folder '''lib''' next to '''odfxsltrunner.jar''' file.

== Background Information ==

[http://blogs.sun.com/GullFOSS/entry/applying_xslt_stylesheets_to_odf Applying XSLT stylesheets to ODF documents with Ant]
</text>
  <text-as-html>&lt;div id='toc' class='toc'&gt;
           &lt;div id='toctitle' class='toc-title'&gt;
             &lt;span&gt;Contents&lt;/span&gt;
           &lt;/div&gt;
           &lt;div id='toccontents' class='toc-contents'&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;1 &lt;a href='#Apply_XSLT_stylesheets_to_ODF_documents_with_Ant'&gt; Apply XSLT stylesheets to ODF documents with Ant &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2 &lt;a href='#Getting_and_building_ODFXSLTRunnerTask'&gt; Getting and building ODFXSLTRunnerTask &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3 &lt;a href='#Usage'&gt; Usage &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;4 &lt;a href='#Parameters'&gt; Parameters &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5 &lt;a href='#Parameters_specified_as_nested_elements'&gt; Parameters specified as nested elements &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;5.1 &lt;a href='#Param'&gt; Param &lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;5.1.1 &lt;a href='#Parameters'&gt; Parameters &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;6 &lt;a href='#Requirements'&gt; Requirements &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;7 &lt;a href='#Background_Information'&gt; Background Information &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;/div&gt;
         &lt;/div&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Apply_XSLT_stylesheets_to_ODF_documents_with_Ant'&gt;&lt;/a&gt; Apply XSLT stylesheets to ODF documents with Ant &lt;/h2&gt;
&lt;p&gt;&lt;b&gt;ODFXSLTRunnerTask&lt;/b&gt; is a task definition for &lt;a class='external' href=&quot;http://ant.apache.org/&quot;&gt;Ant&lt;/a&gt; which allows to apply XSLT stylesheets to ODF documents similar to Ant's build-in &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; &lt;a class='external' href=&quot;http://ant.apache.org/manual/CoreTasks/style.html&quot;&gt;task&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Getting_and_building_ODFXSLTRunnerTask'&gt;&lt;/a&gt; Getting and building ODFXSLTRunnerTask &lt;/h2&gt;
&lt;p&gt;&lt;b&gt;odfxsltrunnertask&lt;/b&gt; is build by a NetBeans project. After you have checked out the &lt;a class='external' href=&quot;http://odftoolkit.openoffice.org/source/browse/odftoolkit/tools/odfxsltrunnertask/&quot;&gt;sources&lt;/a&gt;, you can open the project in &lt;a class='external' href=&quot;http://www.netbeans.info/downloads/index.php&quot;&gt;NetBeans&lt;/a&gt; and build &lt;b&gt;odfxsltrunnertask&lt;/b&gt;.

&lt;/p&gt;&lt;p&gt;A binary release of &lt;b&gt;odfxsltrunnertask.jar&lt;/b&gt; is &lt;a class='external' href=&quot;http://odftoolkit.openoffice.org/files/documents/254/4289/odfxsltrunnertask.jar&quot;&gt;available here&lt;/a&gt;.

&lt;/p&gt;&lt;p&gt;Building and running &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; requires additional jar files. Please see &lt;a href='#Requirements' class='internal'&gt;Requirements&lt;/a&gt; for details.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Usage'&gt;&lt;/a&gt; Usage &lt;/h2&gt;
&lt;p&gt;
To use &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; with Ant, you have to include the following &lt;a class='external' href=&quot;http://ant.apache.org/manual/CoreTasks/taskdef.html&quot;&gt;task definition&lt;/a&gt; into your buildfile, where &lt;i&gt;&lt;tt&gt;&amp;lt;path&amp;gt;&lt;/tt&gt;&lt;/i&gt; has to be replaced with the path where you have stored the &lt;b&gt;odfxsltrunnertask.jar&lt;/b&gt; and &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; files:

&lt;/p&gt;&lt;pre&gt; 
 &amp;lt;taskdef name=&amp;quot;odfxslt&amp;quot; classname=&amp;quot;odfxsltrunnertask.ODFXSLTRunnerTask&amp;quot; classpath=&amp;quot;&lt;i&gt;&amp;lt;path&amp;gt;&lt;/i&gt;/odfxsltrunnertak.jar:&lt;i&gt;&amp;lt;path&amp;gt;&lt;/i&gt;/odfxsltrunner.jar&amp;quot;/&amp;gt;
 
&lt;/pre&gt;&lt;p&gt;
You can use this task definition on the top level (that is as a child element of the &lt;tt&gt;&amp;lt;project&amp;gt;&lt;/tt&gt; element or locally within a single &lt;tt&gt;&amp;lt;target&amp;gt;&lt;/tt&gt; element. It defines a new task &lt;tt&gt;&amp;lt;odfxslt&amp;gt;&lt;/tt&gt; which allows to process ODF documents with XSLT stylesheets.

&lt;/p&gt;&lt;p&gt;The new task supports the use of nested &lt;tt&gt;&amp;lt;param&amp;gt;&lt;/tt&gt; elements which have the same meaning as the &lt;tt&gt;&amp;lt;param&amp;gt;&lt;/tt&gt; child elements of the &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; &lt;a class='external' href=&quot;http://ant.apache.org/manual/CoreTasks/style.html&quot;&gt;task&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Parameters'&gt;&lt;/a&gt; Parameters &lt;/h2&gt;
&lt;p&gt;&lt;table border=&quot;border&quot;&gt;&lt;tr&gt;&lt;th&gt;Attribute&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Required&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;in&lt;/td&gt;&lt;td&gt;specifies an ODF document to which the stylesheet is applied.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless infile has been specified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;infile&lt;/td&gt;&lt;td&gt;specifies a plain XML document to which the stylesheet is applied.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless in has been specified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;out&lt;/td&gt;&lt;td&gt;specifies an ODF document to which the result of the transformation is stored.&lt;br /&gt;
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.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless outfile has been specified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;outfile&lt;/td&gt;&lt;td&gt;specifies a plain XML document to which the result of the transformation is stored.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes, unless out has been specified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;path&lt;/td&gt;&lt;td&gt;Specifies the stream within the ODF packages specified by in and out, which is the source or target of the transformation.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;template&lt;/td&gt;&lt;td&gt;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.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No:  Default is &amp;quot;content.xml&amp;quot;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;force&lt;/td&gt;&lt;td&gt;Specifies that the target file shall be recreated, even if it is newer than the source file or the stylesheet.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;No: Default is false&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Parameters_specified_as_nested_elements'&gt;&lt;/a&gt; Parameters specified as nested elements &lt;/h2&gt;
&lt;h3&gt;&lt;a name='Param'&gt;&lt;/a&gt; Param &lt;/h3&gt;
&lt;p&gt;
Param specifies a parameter that is passed as &lt;a class='external' href=&quot;http://www.w3.org/TR/1999/REC-xslt-19991116#top-level-variables&quot;&gt;XSLT parameter&lt;/a&gt; to the XSL stylesheet.

&lt;/p&gt;&lt;h4&gt;&lt;a name='Parameters'&gt;&lt;/a&gt; Parameters &lt;/h4&gt;
&lt;p&gt;&lt;table border=&quot;border&quot;&gt;&lt;tr&gt;&lt;th&gt;Attribute&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Required&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;name&lt;/td&gt;&lt;td&gt;name of the paramter.&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;expression&lt;/td&gt;&lt;td&gt;value of the paramter.
&lt;b&gt;Note:&lt;/b&gt; All parameter values are passed as string values to the XSLT paramters specified by &lt;tt&gt;&amp;lt;xslt:param&amp;gt;&lt;/tt&gt; elements within the stylesheet.
&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;Yes&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The paramters &lt;tt&gt;if&lt;/tt&gt; and &lt;tt&gt;unless&lt;/tt&gt; which are supported by the &lt;tt&gt;&amp;lt;xslt&amp;gt;&lt;/tt&gt; task are (not yet) supported.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Requirements'&gt;&lt;/a&gt; Requirements &lt;/h2&gt;
&lt;p&gt;&lt;b&gt;odfxsltrunnertask&lt;/b&gt; requires &lt;a class='external' href=&quot;http://java.sun.com/javase/downloads/index.jsp&quot;&gt;J2RE 5&lt;/a&gt;, or a later version of Java. 

&lt;/p&gt;&lt;p&gt;It further requires &lt;a href='&lt;?url_for_page ODFXSLTRunner?&gt;' class='internal'&gt;ODFXSLTRunner&lt;/a&gt; and &lt;a class='external' href=&quot;http://odftoolkit.openoffice.org/servlets/ProjectDocumentList?folderID=759&amp;expandFolder=759&amp;folderID=771&quot;&gt;ODFDOM&lt;/a&gt; (at least version  v0.6.1). 

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; When building &lt;b&gt;odfxsltrunertask&lt;/b&gt;, the &lt;b&gt;odfxsltrunner&lt;/b&gt; project has be checked out, too. It is build automatically.

&lt;/p&gt;&lt;p&gt;In the Ant task definition, the &lt;b&gt;classpth&lt;/b&gt; attribute must include the &lt;b&gt;odfxsltrunnertask.jar&lt;/b&gt; and &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; files. The  ODFDOM jar file is found automatically if it is located in a folder called &lt;b&gt;lib&lt;/b&gt; next to the &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; file. 

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; &lt;a href='&lt;?url_for_page ODFDOM?&gt;' class='internal'&gt;ODFDOM&lt;/a&gt; v0.6.1  requires &lt;a class='external' href=&quot;http://xml.apache.org/dist/xerces-j/&quot;&gt;Apache's xerces&lt;/a&gt;. The jar file &lt;b&gt;xercesImpl.jar&lt;/b&gt; also must exist in a folder &lt;b&gt;lib&lt;/b&gt; next to &lt;b&gt;odfxsltrunner.jar&lt;/b&gt; file.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Background_Information'&gt;&lt;/a&gt; Background Information &lt;/h2&gt;
&lt;p&gt;&lt;a class='external' href=&quot;http://blogs.sun.com/GullFOSS/entry/applying_xslt_stylesheets_to_odf&quot;&gt;Applying XSLT stylesheets to ODF documents with Ant&lt;/a&gt;&lt;/p&gt;</text-as-html>
  <updated-at type="datetime">2009-02-10T13:43:32Z</updated-at>
  <wiki-id type="integer">51</wiki-id>
</page>
