如何使用Ant执行XSLT 2.0吗? [英] How to execute XSLT 2.0 with ant?

查看:249
本文介绍了如何使用Ant执行XSLT 2.0吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行从蚂蚁文件XSLT转换。

I'm trying to run an XSLT transformation from an ant file.

我使用XSLT 2.0样式表与撒克逊9 解析器(支持XSLT 2.0)。

I'm using a XSLT 2.0 stylesheet with a saxon 9 parser (supporting XSLT 2.0).

的问题是,它似乎蚂蚁总是调用一个XSLT 1.0解析器

The problem is that it seems that ant is always calling an XSLT 1.0 parser.

下面是我的Ant文件:

Here's my ant file :

<xslt style="stylesheet.xslt"
   basedir="core/"    
   extension=".xml"
   destdir="core/"
   classpath="D:\\DevTools\\saxon\\bin\\saxon9.jar">
</xslt>

如果我直接调用它(不蚂蚁),它的工作。

If I call it directly (without ant), it's working.

任何想法?

推荐答案

现在的问题是,虽然Saxon是添加到类路径,默认JAXP机制来确定的TransformerFactory使用,它会使用默认的就是Xalan的。你要么需要:

The problem is that while Saxon is added to the classpath, the default JAXP mechanism to determine which TransformerFactory is used and it will use the default that is Xalan. You either need to:


  • 设置 javax.xml.transform.TransformerFactory中系统变量 net.sf.saxon.TransformerFactoryImpl

  • 添加saxon9.jar到 CLASSPATH 系统变量,或

  • 使用&LT;厂名=net.sf.saxon.TransformerFactoryImpl/&GT; 中的 XSLT 元素

  • Set javax.xml.transform.TransformerFactory system variable to net.sf.saxon.TransformerFactoryImpl,
  • Add saxon9.jar to the CLASSPATH system variable, or
  • Use <factory name="net.sf.saxon.TransformerFactoryImpl"/> inside the xslt element

这篇关于如何使用Ant执行XSLT 2.0吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆