Apache Ant/运行 Saxon
外观
	
	
您希望有一个运行 Saxon XSLT 转换的 Apache Ant 任务。
下载 Saxon jar 文件。将 saxon.jar 文件放到 lib 文件夹中。运行以下测试。
以下是 Apache Ant 如何调用 Saxon 的方法。
<target name="test-saxon">
   <xslt classpath="lib\saxon8.jar"
      in="in.xml" 
      out="out.html" 
      style="check-version.xsl">
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
   </xslt>
</target>
请注意,如果您在 Eclipse 中运行,则需要转到“首选项”菜单并将 saxon9.jar 文件添加到 Ant/运行时/Ant 主目录条目中。只需点击“添加 JAR”并将 saxon9jar 文件添加到此列表的末尾。
check-version.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/">
        <results>
            <Version><xsl:value-of select="system-property('xsl:version')" /></Version>
            <Vendor><xsl:value-of select="system-property('xsl:vendor')" /></Vendor>
            <Vendor-URL><xsl:value-of select="system-property('xsl:vendor-url')" /></Vendor-URL>
        </results>
    </xsl:template>
</xsl:stylesheet>
或者,如果您正在生成网页
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:template match="/">
      <html>
        <head>
         <title>XSL Version</title>
        </head>
        <body>
           <p>Version:
           <xsl:value-of select="system-property('xsl:version')" />
           <br />
           Vendor:
           <xsl:value-of select="system-property('xsl:vendor')" />
           <br />
           Vendor URL:
           <xsl:value-of select="system-property('xsl:vendor-url')" />
           </p>
        </body>
     </html>
  </xsl:template>
</xsl:stylesheet>
Apache XALAN 的结果
1.0 Vendor: Apache Software Foundation (Xalan XSLT) Vendor URL: http://xml.apache.org/xalan-j
版本:2.0 供应商:SAXON 9.1.0.7 来自 Saxonica 供应商网址:http://www.saxonica.com/