XSLTXT - Ant integration

It's now possible to use XSLTXT to transform files under the control of an Ant build file. There are two ways to do this:

Using processor

To use xsltxt stylesheets instead of xsl stylesheets in an existing style task you need to add a processor attribute to the style element. The style task otherwise behaves exactly the same.

    <style
      style="tests/test_01/txt/rpt1.txt"
      in="tests/test_01/xml/test.xml"
      out="tests/test_01/txtresults/rpt1.html"
      processor="com.zanthan.xsltxt.ant.XSLTXTLiaison"
      force="true"/>
	

Using the xsltxt task

Instead of using the processor property you could use the xsltxt task instead of the style task. This is a drop in replacement for the style task supporting all of the same attributes and sub-elements as style. To make the xsltxt task available you have to add a taskdef element to your build file to specify the class that implements the xsltxt task.

  <taskdef name="xsltxt" 
    classname="com.zanthan.xsltxt.ant.XSLTXTProcess"/>
  
  <target name="test">
    <mkdir dir="${basedir}/tests/test_01/txtresults"/>
    
    <xsltxt
      style="tests/test_01/txt/rpt1.txt"
      in="tests/test_01/xml/test.xml"
      out="tests/test_01/txtresults/rpt1.html"
      force="true"/>

  </target>
        

Library requirements

To use either technique you need to add to the classpath used by Ant. You must add the xsltxt classes, perhaps from xsltxt-bin.jar, and the log4j classes. For example:

  # Add to classpath
  export CLASSPATH=$CLASSPATH:lib/log4j.jar:lib/xsltxt-bin.jar

  # invoke Ant
  /usr/local/java/jakarta-ant/bin/ant -emacs