I have just recently been working with xslt2.0 via ant. I have a build file that looks like so:
<project name="TranformXml" default="TransformFile">
<target name="TransformFile">
<xslt in="input.xml"
out="student.html"
style="transform.xsl"
processor="trax" classpath="./lib/saxon/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
</project>
an input document input.xml:
<student_list>
<student>
<name>George Washington</name>
<major>Politics</major>
<phone>312-123-4567</phone>
<email>[email protected]</email>
</student>
</student_list>
and stylesheet, transform.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>Student Directory</title>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
and output from my ant build:
ant -f build.xml
Buildfile: /home/casey/Development/ant-tests/xslt-transform/build.xml
TransformFile:
[xslt] Processing /home/casey/Development/ant-tests/xslt-transform/input.xml to /home/casey/Development/ant-tests/xslt-transform/student.html
[xslt] Loading stylesheet /home/casey/Development/ant-tests/xslt-transform/transform.xsl
BUILD SUCCESSFUL
Total time: 9 seconds
I find it hard to believe that it should take 9 seconds to do all this. When in production the stylesheets are going to be alot more complex and the input much larger. Realistically I'd like to keep the whole transform process to less than a few seconds.
Any ideas?
Thanks,
Casey
@processor="trax"and specifying the<factory>seemed to help. The other issue could be classloader and finding the saxon9he.jar. Testing with your example, it ran in 3 seconds for me(Win7, Java 6, ANT 1.8.2) What version of ANT are you using?