I'm embarrassed. After your suggestion about <factory> I skimmed the ant doc too quickly and entirely missed it, so I assumed you were referring to a feature of <saxon-xslt>. Then I did find out that I could set the factory using the javax.xml.transform.TransformerFactory
system property for a java invocation, but I didn't have much luck invoking ant successfully using the <java> task which supports setting the system property. In the end I gave up.
However, after your last post I checked the ant <xslt> doc again, found the description of <factory> and tried it. The weird thing is that having specified the saxon8.jar in the classpath
attribute of <xslt> and the net.sf.saxon.TransformerFactoryImpl
in the <factory> element, the <xslt> task failed to find the factory class. I had to add saxon8.jar to the classpath of my invocation of ant, and then everything worked beautifully - thank-you!
I think ant's implementation for the <xslt> classpath
attribute has got to be something really weird, because it certainly doesn't behave in any way that makes sense to me.
So here's the answer for anyone who wants to mix XSLT 1.0 and XSLT 2.0 invocations in the same ant script:
Make sure that the classpath passed into Ant has the necessary jars for both XSLT 1.0(either Xalan with Xerces or Saxon 6) and XSLT 2.0(Saxon 8). Then don't bother with the classpath
attribute of <xslt>. Instead use something like the following:
Thanks again for all your help!