Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 3057

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?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 2011-12-09T20:47:22.916Z--><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>
      <p>There is a history of bugs in successive releases of Ant that mean not all these features work in every Ant
      version. In particular, the <code>classpath</code> attribute of the <code>xslt</code> task element has
      been unreliable: the safest approach is to ensure that the Jar files needed to run Saxon are present on
      the externally-specified classpath (the classpath at the point where Ant is invoked), rather than relying
      on the task-specific classpath.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="embedding.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>