Ant XSLT task vs. Java task
I've inherited a project which contains an开发者_JAVA技巧 ant build file. We are in the process of upgrading libraries, and when we did our ancient XSLT translator began flaking out. I've attempted to replace the calls with ant's XSLT task, however it throws some errors in our translators (xalan at the command line throws no such error).
Is there a way to use the fileset in combination with a java task? It would sure beat having to repeat the majority of the call umpteen times. The only thing I can really think of is passing a variable to a sub-ant task, but perhaps there is a better way?
Read this carefully in the preamble to the XSLT task:
Note: If you are using JDK 1.4 or higher, this task does not require external libraries not supplied in the Apache Ant distribution. However, often the built in XSL engine is not as up to date as a fresh download, so an update is still highly recommended in particular since the built-in XSLT processors of Java 5 (and to a certain extent Java 6) are known to have serious issues. See Library Dependencies for more information.
If you are running the latest version of Ant, the XSLT task has a classpath/classpathref
parameters that supposedly are used to locate the XSLT processor.
Because our project started before 1.8 was released, we've used the "usual" Ant way of supplying such libraries: either by copying them to the ant's lib
dir or by supplying -lib
switch for the ant
call.
Note, for Xalan to work properly you need to add both xalan-X.X.X.jar
and xalan-serializer-X.X.X.jar
to the classpath.
精彩评论