Problems in Ant transform, xslt task and manually specified TransformerFactory

Hi, I have Ant build file which works perfectly outside oXygen. For various reasons both Saxon9 and Saxon6 has to be called during the build process, so xslt task always specifies which transformer to use using factory: <xslt ...> <factory name="net.sf.saxon.TransformerFactoryImpl"> <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/> </factory> <classpath location="${saxon9.jar}"/> </xslt> or <xslt ...> <factory name="com.icl.saxon.TransformerFactoryImpl"/> <classpath> <pathelement location="${saxon.jar}"/> </classpath> </xslt> Problem is that in oXygen (12.2, Windows/Linux) such Ant task produces the following error message: BUILD FAILED .....\build.xml:126: java.lang.ClassNotFoundException: com.icl.saxon.TransformerFactoryImpl I suppose that's because oXygen uses special classloader. Do you have any idea how to overcome this issue? I need to run same Ant script from oXygen and standalone as well. Thanks, Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML consulting and training services DocBook customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member ------------------------------------------------------------------

Hi Jirka, The ANT process started by Oxygen for an ANT transformation scenario is a separate process and does not use the Oxygen available libraries or class loaders. But if you edit the ANT transformation scenario, in the "Options" tab you have a "Libraries" button which you can use to add additional libraries to the started process class path. You can add for example the Saxon 6 libraries which come in the Oxygen installation "lib "directory. In your case I also see you have a classpath reference in the <xslt> task like:
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a value for the "saxon9.jar" parameter name? Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 8/8/2011 1:21 AM, Jirka Kosek wrote:
Hi,
I have Ant build file which works perfectly outside oXygen. For various reasons both Saxon9 and Saxon6 has to be called during the build process, so xslt task always specifies which transformer to use using factory:
<xslt ...> <factory name="net.sf.saxon.TransformerFactoryImpl"> <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/> </factory> <classpath location="${saxon9.jar}"/> </xslt>
or
<xslt ...> <factory name="com.icl.saxon.TransformerFactoryImpl"/> <classpath> <pathelement location="${saxon.jar}"/> </classpath> </xslt>
Problem is that in oXygen (12.2, Windows/Linux) such Ant task produces the following error message:
BUILD FAILED .....\build.xml:126: java.lang.ClassNotFoundException: com.icl.saxon.TransformerFactoryImpl
I suppose that's because oXygen uses special classloader. Do you have any idea how to overcome this issue? I need to run same Ant script from oXygen and standalone as well.
Thanks,
Jirka
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

On 8.8.2011 8:06, Radu Coravu wrote:
The ANT process started by Oxygen for an ANT transformation scenario is a separate process and does not use the Oxygen available libraries or class loaders.
I see, but there are still some strange things happening because Ant run from oXygen behaves slightly differently then when invoked from command-line. But I'm using standalone ant from command line, not one bundled with oXygen (but same version 1.8.2).
But if you edit the ANT transformation scenario, in the "Options" tab you have a "Libraries" button which you can use to add additional libraries to the started process class path. You can add for example the Saxon 6 libraries which come in the Oxygen installation "lib "directory.
Thanks, I was hoping that it will be possible to make it work without it. But adding libraries this way solved problem.
In your case I also see you have a classpath reference in the <xslt> task like:
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a value for the "saxon9.jar" parameter name?
Sure, I was just extracting snippet from more complex build.xml. Property is correctly set. Anyway thanks, Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz ------------------------------------------------------------------ Profesionální školení a poradenství v oblasti technologií XML. Podrobný přehled školení http://xmlguru.cz/skoleni/ ------------------------------------------------------------------ http://docbook.cz Stránky o dokumentačním formátu DocBook http://xmlguru.cz Blog mostly about XML for English readers ------------------------------------------------------------------

Hi Jirka, Basically the "ant.bat" usually has some class paths and parameters specified before starting the ANT process. As the Oxygen ANT transformation scenario starts the Java process directly all these settings need somehow to be added as options to the ANT scenario. So yes, there are differences, Oxygen does not start ANT by invoking the "ant.bat" executable. Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 8/11/2011 6:04 PM, Jirka Kosek wrote:
On 8.8.2011 8:06, Radu Coravu wrote:
The ANT process started by Oxygen for an ANT transformation scenario is a separate process and does not use the Oxygen available libraries or class loaders.
I see, but there are still some strange things happening because Ant run from oXygen behaves slightly differently then when invoked from command-line. But I'm using standalone ant from command line, not one bundled with oXygen (but same version 1.8.2).
But if you edit the ANT transformation scenario, in the "Options" tab you have a "Libraries" button which you can use to add additional libraries to the started process class path. You can add for example the Saxon 6 libraries which come in the Oxygen installation "lib "directory.
Thanks, I was hoping that it will be possible to make it work without it. But adding libraries this way solved problem.
In your case I also see you have a classpath reference in the<xslt> task like:
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a value for the "saxon9.jar" parameter name?
Sure, I was just extracting snippet from more complex build.xml. Property is correctly set.
Anyway thanks,
Jirka
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
Jirka Kosek
-
Radu Coravu