How can I use XSLTC in Java 5.0 to test a transformation?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
swpalmer

How can I use XSLTC in Java 5.0 to test a transformation?

Post by swpalmer »

I have a style sheet and a document that is transforming properly when I test in oXygen, but in my application the transformation doesn't work quite right.

I'm not sure if I am doing anything illegal, but since oXygen didn't complain I assumed not.

As part of my testing I wanted to try to force oXygen to use the same version of the transformer that is included with Java 1.4.2_05 or Java 5.0 - both have the same problem in my program. I know that Java 5.0 uses XSLTC, and 1.4.2 uses a version of Xalan, but I suspect not the same version that oXygen uses.

I tried forcing the use of the XSLTC transformer (I run oXygen under the latest Java 5 snapshot) by specifying the class to use for JAXP as com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl which seems to be how it is included in the JRE 5.0.
When I try this I get an error setting up the transfromer. the error details are the class name and nothing more (i.e. NOT class not found).

Has anyone tried this and gotten it to work?

This may not help with my problem anyway of course... the original problem qith my transform not working is related to namespaces I think. Something I haven't done much with, since I just know enough about XSLT/XML to hack together the transformation I have. But I thought I had the namespace issues licked when I finally got the transformation working within oXygen, only to be surprized when my application had trouble using the same data.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

You need to start oXygen bypassing the custom class loading added to make sure our jars are used. For this you should write a lauch script placing all the jars in the lib directory in the classpath, something like below:

Code: Select all



@echo on

set ROOT=./lib
java -Xmx256m -cp "classes;.;%ROOT%/oxygen.jar;%ROOT%/help.zip;%ROOT%/log4j.jar;%ROOT%/xercesImpl.jar;%ROOT%/xml-apis.jar;%ROOT%/xalan.jar;%ROOT%/jhall.jar;%ROOT%/fop.jar;%ROOT%/logkit-1.0.jar;%ROOT%/avalon-framework-4.0.jar;%ROOT%/batik.jar;%ROOT%/saxon8.jar;%ROOT%/saxon.jar;%ROOT%/resolver.jar;%ROOT%/gnu-regexp-1.1.4.jar;%ROOT%/jakarta-regexp-1.3.jar" ro.sync.exml.Launcher %1 %2 %3 %4 %5 %6 %7 2>null
In general a new transformer can be added through JAXP by placing its jar(s) in the lib folder and oXygen will load it automatically from there.

An alternative is the Eclipse plugin. You should be able to configure the Xalan that comes with Java 1.5.0 from there without any classpath issue.

Best Regards,
George
Post Reply