Getting XMLSpy to support EXSLT dynamic functions
Recently I have been using XSLT to transform XML from one format to the other. I use Xalan (for Java) in the application itself, but often develop and debug with XMLSpy. I needed a way for XSLT to dynamically evaluate and select a given string, and found no easy way to do this other than the EXSLT dyn extentions.
After implementing the evalute() function, I quickly discovered that neither the default XMLSpy XSLT engine, nor MSXML recognize it. So, after a few fruitless attempts I finally decided to use the same engine that I’m using in the Java application. I simply needed to go under Tools -> Options -> XSL, then select External XSL Transformation Program.
Input:
java -cp XALAN_PATH\xalan.jar org.apache.xalan.xslt.Process -in %1 -xsl %3 -out %2
Now everything transforms as expected!
4 Responses
OK, and when we get a ClassNotFound Exception, how can we install the class and from which source?
Do we need a standalone installation of Xalan into the Java environment?
Thanks!
It’s been a while since I wrote this post, so the version of the Xalan .jar I used was from 2005. I doubt the class names have changed, so I would first recommend that you very executing the statement:
java -cp XALAN_PATH\xalan.jar org.apache.xalan.xslt.Process -in %1 -xsl %3 -out %2
from the command line first. Of course, replace XALAN_PATH with the actual location on your hard drive (e.g. c:\java\libs\xalan.jar). And, make %1 your source file, %3 your .xsl file, and %2 your desired output file.
This works fine for me:
java -classpath c:\work\xalan-j_2_7_1\xalan.jar org.apache.xalan.xslt.Process -IN %1 -XSL %3 -OUT %2
Solution works for me (only with additional brackets):
java -cp “C:\Program Files (x86)\xalan-j_2_7_1\xalan.jar” org.apache.xalan.xslt.Process -in %1 -xsl %3 -out %2