<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="using-xsl" page="xsltfromant" subpage=""/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: Running Saxon XSLT transformations from Ant</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Running Saxon XSLT transformations from Ant"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Running Saxon XSLT transformations from Ant</h1>
      <p>It is possible to run a Saxon transformation from Ant using the standard 
<a href="http://ant.apache.org/manual/CoreTasks/style.html" class="bodylink">xslt task</a>,
by using the <code>trax</code> processor and with an appropriate <code>classpath</code> that forces 
Saxon to be selected. This can now be used to 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).</p>
      <p>The custom Ant task developed for earlier Saxon releases is not being further developed, although it remains available. It is no longer issued as
an intrinsic part of the Saxon product, but can be downloaded as a separate package from SourceForge: see
<a href="https://sourceforge.net/project/showfiles.php?group_id=29872"
            class="bodylink">https://sourceforge.net/project/showfiles.php?group_id=29872</a>
For information, see the documentation accompanying Saxon 9.2 or earlier releases.</p>
      <p>Saxon-specific configuration options can be specified using the <code>attribute</code> child of the <code>factory</code>
element. For example, the following switches on Saxon tracing (the equivalent of the -T option on the command line)</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
  &lt;factory name="net.sf.saxon.TransformerFactoryImpl"&gt;
     &lt;attribute name="http://saxon.sf.net/feature/traceListenerClass" 
                value="net.sf.saxon.trace.XSLTTraceListener"/&gt;
  &lt;/factory&gt;
</code>
         </pre>
      </div>
      <p>For a full list of feature names, see the Javadoc documentation of class <code>net.sf.saxon.FeatureKeys</code>.</p>
      <p>With Saxon-PE and Saxon-EE it is possible to get detailed control of the configuration by specifying 
the name of a Saxon configuration file using this mechanism, for example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
  &lt;factory name="com.saxonica.config.EnterpriseTransformerFactory"&gt;
    &lt;attribute name="http://saxon.sf.net/feature/configuration-file" 
               value="config-de.xml"/&gt;
  &lt;/factory&gt;</code>
         </pre>
      </div>
      <p>In this case this must be the first attribute.</p>
      <p>The initial template and initial mode for the transformation can be specified using the attribute names
<code>http://saxon.sf.net/feature/initialTemplate</code> and <code>http://saxon.sf.net/feature/initialMode</code>
respectively. The value is a QName in Clark notation (that is <code>{uri}local</code>).</p>
      <p>Note that names in Clark notation may also be used for the qualified names of  stylesheet parameters and 
serialization options.</p>
      <p>Note that an Ant transformation always has an input file. If necessary, a dummy file can be specified.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="embedding.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>