Page 1 of 1

Can I use SaxonEE in DITA ANT transformation?

Posted: Tue Sep 02, 2014 9:58 am
by tmakita
Hi,

This is very basic question.
For a long time I used DITA-OT 1.7.5 for plug-in development with DITA-OT bundled SaxonB-9.1.
Now I found a (possible) bug in 9.1. So I want to test it with oXygen 16.0 bundled newest SaxonEE.

1. I added following -lib paramater to ANT transoformation scenario.

-lib C:\PROGRA~1\OXYGEN~2\lib\saxon9ee.jar

2. But Saxon failed with error that he cannot found external Java function. This is not occur in SaxonB-9.1.

Code: Select all

transform.merged:
[xslt] Processing D:\My_Documents\XML2011\xxx\testdata\20140899-diff-html\en-US\workset\temp\20140899_diff_MERGED.xml to D:\My_Documents\XML2011\xxx\testdata\20140899-diff-html\en-US\workset\temp\20140899_diff_CONVERTED.xml
[xslt] Loading stylesheet D:\DITA-OT\DITA-OT1.7.5-bil\plugins\co.xxx.review_pdf\xsl\dita2fo_convmerged.xsl
[xslt] D:\DITA-OT\DITA-OT1.7.5-bil\plugins\co.xxx.pdf.common\xsl\dita2fo_convmerged_sorting_table.xsl:142:146: Fatal Error! Cannot find a matching 3-argument function named {java:jp.co.antenna.ah_i18n_glossary.GlossarySortSaxon9}glossarySortSaxon9(). For diagnostics on calls to Java methods, use the -TJ command line option or set the Configuration property FeatureKeys.TRACE_EXTERNAL_FUNCTIONS
[xslt] Failed to process D:\My_Documents\XML2011\xxx\testdata\20140899-diff-html\en-US\workset\temp\20140899_diff_MERGED.xml
This error frequently occurs when Saxon runs in HE (Home edition) mode.

Can I run SaxonEE from ANT transformation scenario enabling external Java function call?

Any suggestions are welcome.

Regards,

Toshihiko Makita

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Tue Sep 02, 2014 11:04 am
by Radu
Hi Toshihiko,

The Saxon EE owner (Michael Kay) licensed it to Oxygen with the condition that it should only be run as licensed when a transformation is started from Oxygen.
Did you configure and run an ANT transformation scenario from Oxygen?

If you create and invoke an ANT transformation scenario from Oxygen it is possible to run with a licensed version of Saxon EE.
In the created ANT transformation scenario, in the "Options" tab there is a "Libraries" button:

http://www.oxygenxml.com/doc/ug-oxygen/ ... s-tab.html

which you can click and add references to required libraries. It is important that in the libraries list, before the reference to Oxygen's Saxon EE libraries you should add references to the following libraries:

Code: Select all

${oxygenHome}/classes/
${oxygenHome}/lib/oxygen.jar
${oxygenHome}/lib/oxygenAuthor.jar
${oxygenHome}/lib/oxygenDeveloper.jar
${oxygenHome}/lib/oxygenEclipse.jar
${oxygenHome}/lib/oxygenAuthorEclipse.jar
${oxygenHome}/lib/oxygenDeveloperEclipse.jar
which are the trick to registering the Saxon EE libraries.


Another way to do this would be to create a transformation scenario in Oxygen of type DITA OT and change in it the path to the used DITA Open Toolkit installation:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ta-ot.html

Regards,
Radu

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Sat Jul 15, 2017 4:59 pm
by tmakita
Hi Radu,

Is above method still available in oXygen 19.0?
I wrote the following ant build file and still got "No license" message even if I added "-lib" option to the scenario.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="test.xslt.build">
<property name="input.file" value="input.xml"/>
<property name="output.file" value="output-xslt3.xml"/>
<property name="xsl.file" value="test-pkg-main-xslt3.xsl"/>
<property name="config.file" value="config.xml"/>
<path id="saxon.class.path">
<pathelement location="C:\Users\toshi\AppData\Roaming\com.oxygenxml\extensions\v19.0\plugins\https___www.oxygenxml.com_InstData_Addons_default_updateSite.xml\oxygen-sample-plugin-tranformer-saxon-9-8-19.0\lib\saxon9ee.jar"/>
</path>
<path id="project.class.path">
<path refid="saxon.class.path"/>
<pathelement path="${java.class.path}"/>
</path>
<java classname="net.sf.saxon.Transform" classpathref="project.class.path">
<arg value="-s:${input.file}"/>
<arg value="-o:${output.file}"/>
<arg value="-xsl:${xsl.file}"/>
<arg value="-config:${config.file}"/>
<arg value="-t"/>
</java>
</project>
The log file:

Code: Select all

Executing:
"c:\program files\oxygen xml editor 19\jre/bin/java" -Xmx256m -classpath "D:\My_Documents\Java\apache-ant-1.10.1-bin\apache-ant-1.10.1/lib/ant-launcher.jar" "-Dant.home=D:\My_Documents\Java\apache-ant-1.10.1-bin\apache-ant-1.10.1" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Editor 19\lib\oxygen.jar" -lib "C:\Program Files\Oxygen XML Editor 19\lib\saxon9ee.jar" -lib "C:\Program Files\Oxygen XML Editor 19\lib\xercesImpl.jar" -lib "C:\Program Files\Oxygen XML Editor 19\lib\resolver.jar" -lib "C:\Program Files\Oxygen XML Editor 19\lib\log4j.jar" -f "build.xml" "-Dwebhelp.trial.license=no" -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/classes/ -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygen.jar -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygenAuthor.jar -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygenDeveloper.jar -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygenEclipse.jar -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygenAuthorEclipse.jar -lib file:/C:/Program%20Files/Oxygen%20XML%20Editor%2019/lib/oxygenDeveloperEclipse.jar

Buildfile: C:\Users\toshi\OneDrive\Documents\test\xslt\20170423-package\build.xml
[java] Saxon-EE 9.8.0.1J from Saxonica
[java] Java version 1.8.0_121
[java] No license file found - running with licensable features disabled
[java] Stylesheet compilation time: 1.394047s (1394.047353ms)
[java] Processing file:/C:/Users/toshi/OneDrive/Documents/test/xslt/20170423-package/input.xml
[java] Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
[java] Building tree for file:/C:/Users/toshi/OneDrive/Documents/test/xslt/20170423-package/input.xml using class net.sf.saxon.tree.tiny.TinyBuilder
[java] Tree built in 13.78188ms
[java] Tree size: 10 nodes, 20 characters, 2 attributes
[java] Execution time: 244.486867ms
[java] Memory used: 35,157,112

BUILD SUCCESSFUL
Total time: 4 seconds

The process finished with exit code: 0
Regards,

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Mon Jul 17, 2017 8:05 am
by Radu
Hi Toshishiko,

Probably the problem is that you refer to an external Saxon JAR library:

Code: Select all

<path refid="saxon.class.path"/>
before the java class path. You should probably refer to it after the reference to the Oxygen JAR libraries so that the Oxygen JAR libraries come first in the classpath. You can try to edit the transformation scenario and in the Libraries list remove the reference to the builtin Saxon JAR libraries and add the reference to your Saxon JAR.
If that works great for you but it might probably not work, the Oxygen JAR libraries are tuned to work only with a specific Saxon library bundled with Oxygen.

Regarts,
Radu

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Mon Jul 17, 2017 2:30 pm
by tmakita
Hi Radu,
If that works great for you but it might probably not work, the Oxygen JAR libraries are tuned to work only with a specific Saxon library bundled with Oxygen.
You are right. Changing classpath reference forces oXygen to invoke Saxon EE 9.7.0.15 not Saxon EE 9.8.0.1.
I will test it via XSLT transformation scenario.

Regards,

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Mon Jul 17, 2017 2:42 pm
by tmakita
I will test it via XSLT transformation scenario.
It seems that oXygen XSLT transformation scenario cannot pass the parameter "-config:config.xml" to Saxon.
Is it a limitation?

Regards,

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Mon Jul 17, 2017 3:10 pm
by Radu
Hi Toshihiko,

An Oxygen XSLT transformation scenario does not use Saxon as an external processor, it uses Saxon's Java APIs to work with the processor.
If you edit the transformation scenario, next to the Transformer combo box there is a small settings button which allows you to check various settings and to also specify a configuration file reference.

Regards,
Radu

Re: Can I use SaxonEE in DITA ANT transformation?

Posted: Mon Jul 17, 2017 4:40 pm
by tmakita
Hi Radu,
If you edit the transformation scenario, next to the Transformer combo box there is a small settings button which allows you to check various settings and to also specify a configuration file reference.
Thank you very much!
It worked fine!!

Regards,