2

I'm trying to run an ant XSLT on a large number of files, but it's failing halfway through. I'd like to use the "failOnTransformationError" attribute but I get the following error:

xslt doesn't support the "failOnTransformationError" attribute

My build file looks lie:

<project>
    <xslt
            basedir="xmldir"
            destdir="textdir"
            includesfile="includefile.txt"
            extension=".txt"
            style="style.xsl"
            force="true"
            failOnTransformationError="false"
            >
    <outputproperty name="encoding" value="UTF-8"/>
    </xslt>
</project>

I've also tried running using different processors via the -lib option ,i.e

ant -lib /usr/share/java/saxon-6.5.5.jar
ant -lib /usr/share/java/saxonb-9.0.jar
ant -lib /usr/share/java/saxon.jar
ant -lib /usr/share/java/saxonb-ant.jar

but no luck. I also tried inserting

<classpath location="/usr/share/java/saxonb-9.0.jar"/>

or

<factory name="net.sf.saxon.TransformerFactoryImpl"/>

into the xslt declaration but these had no effect either.

I saw this page http://www.abbeyworkshop.com/howto/xslt/ant-saxon/index.html which simply uses the classpath location. I noticed that the xslt in that case is wrapped by

<target name="xslt2">
 ...
</target>
<target name="TransformAll" depends="xslt2" />

but when I put that into my build file nothing happens (actually, it says "success" but doesn't build any of the files).

I'm running Ubuntu 10.04.3, Apache Ant version 1.7.1

Any clues how to make this work, or any other way to make ant ignore errors (and write them to a log file)?

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
tdc
  • 8,219
  • 11
  • 41
  • 63

2 Answers2

3

failOnTransformationError exists since Ant 1.8, as mentioned in the doc. Are you sure your ant version isn't less than that?

Use ant -version to know.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • Ok that fixed it .... sorry I missed that one! Maybe this will be useful to others though!! – tdc Nov 10 '11 at 09:25
0

There's a long history of ant bugs in this area (I suspect they don't have a very good regression testing suite). See for example

How to execute XSLT 2.0 with ant?

and the things it links to.

Community
  • 1
  • 1
Michael Kay
  • 156,231
  • 11
  • 92
  • 164