# Running Saxon XSLT transformations from Ant

It is possible to run a Saxon transformation from Ant using the standard `xslt` task, by using the `trax` processor and with an appropriate `classpath` that forces Saxon to be selected. However, this doesn't provide the ability to take advantage of the full range of capabilities offered by XSLT 2.0 in general and Saxon in particular (for example, schema aware processing and multiple output files). Saxon 8.9 therefore includes the first early release of a custom Ant task for Saxon.

The is available in `saxon8-ant.jar`, under the class name `net.sf.saxon.ant.AntTransform`. At this early stage it differs little from the standard `xslt` task:

- The `processor` and `classpath` attributes have no effect.

- There is a new boolean attribute `schemaaware` indicating whether the transformation should be schema-aware.

- There is a new attribute `validation` allowing the values strict, lax, or skip. The schema itself must be specified either in the stylesheet (using `xsl:import-schema`) or in the source document (using `xsi:schemaLocation`).

Example usage:

        <target name="release-userdoc" description="Generate User Documentation">
    			<taskdef name="saxon-xslt"
    			         classname="net.sf.saxon.ant.AntTransform"
    			         classpath="c:\saxon\saxon8sa.jar;c:\saxon\licenses"/>

    			<saxon-xslt in="${userdoc.dir}/catalog.xml"
    			            style="${userdoc.dir}/render-page2.xsl"
    			            schemaaware="true"
    			            validation="strict"
    			            out="${release.dir}/resources/doc/dummy.html">
    			  <param name="destination" expression="offline"/>
    			</saxon-xslt>
        </target>

The above example was used to generate this documentation. With multiple output files, a single document is specified for the principal output (which may be a dummy), and all other output files are written in relative locations with respect to this.

Next