Monday 18 June 2007

Using XSLT 2 (Saxon 8) with Ant...

Update: I had this problem again today, my notes from last time didn't work. To get saxon 8 working with ANT (1.7), first get the most up-to-date jars (important!) from sourceforge ( at the time of writing):

Unpack them somewhere (e.g. a /lib directory)

Saxon is called in ANT using something like this:

I hope this helps someone :)

Ok - this is a short post; although I might extend it later on with some examples. If you're having a problem with Ant not using saxon to run the transforms (say, using xalan instead).. But you've added the classpath and you're sure it knows it's supposed to be using saxon, adding this line between your xslt tags might just help...


ke said...

I've had exactly this problem you're describing. Thanks for putting me on a promising track. Now build fails with a java.lang.ClassNotFoundException: net.sf.saxon.TransformerFactoryImpl - Any ideas?

Alex Bleasdale said...

Apologies - I'd only just got around to checking comments and missed this! You may well have solved the problem now, but if not, I think the error is to do with it not knowing the classpath of saxon8.jar. Adding:

<classpath path="/your/path/to/saxon8.jar"/>

Should solve that problem - let me know if it doesn't and I'll post a more detailed example..

The section on classpaths in the ant documentation really is excellent; here's a link:

fun_n_friend said...

Use Ant 1.8. Ant 1.7 has a problem with saxon