xslt Ant任务不向我的样式表传递参数

xslt Ant任务不向我的样式表传递参数,ant,Ant,我有一个这样的样式表 <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="testParam"/> <xsl:template match="@*|node()"> <xsl:copy>

我有一个这样的样式表

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="testParam"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match="resources/integer[@name='LOG_LEVEL']/text()">
        <xsl:value-of select="$testParam"/>
    </xsl:template>
</xsl:stylesheet>

我有这样一个输入xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="LOG_LEVEL">3</integer>
    <string name="app_name">Test Application</string>
</resources>

3.
测试应用
但当我尝试使用以下方法在ant中调用xslt转换时:

<xslt in="in.xml" out="out.xml" style="style_above.xsl">
    <outputproperty name="method" value="xml"/>
    <outputproperty name="encoding" value="UTF-8"/>
    <outputproperty name="indent" value="yes"/>
    <param name="testParam" expression="test"/>
</xslt>

我得到以下信息:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <integer name="LOG_LEVEL"/>
    <string name="app_name">Test Application</string>
</resources>

测试应用

它似乎没有将xslt参数更改为我在ant目标中指定的值

是的,我发现问题是另一回事。即将更新,但为时已晚。我在一个宏中定义了xslt任务,并且有一个可选元素也被命名为param,这就是罪魁祸首。谢谢

顺便说一句,我正在使用ANT 1.8.2,它工作得很好。使用ant 1.8.2对其进行了测试:)