尝试这个:
构建文件:
<project default="createfile2">
<target name="createfile1">
<xslt in="myxml.xml" out="text1.txt" style="test1.xslt">
<param name="d" expression="C:\dir1"/>
</xslt>
</target>
<target name="createfile2" depends="createfile1">
<xslt in="myxml.xml" out="text2.txt" style="test1.xslt">
<param name="d" expression="C:\dir2"/>
</xslt>
</target>
</project>
XSLT 转换
<?xml version="1.0" standalone="yes"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="d"/>
<xsl:output omit-xml-declaration="yes" method="html" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/root/fileset[@dir=$d]">
<xsl:for-each select="include">
<xsl:value-of select="$d"/>\<xsl:value-of select="@name"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
输出文件
text1.txt
C:\dir1\abc.txt
C:\dir1\def.txt
text2.txt
C:\dir2\abc2.txt
C:\dir2\def2.txt