Ant + Saxon9b + multiple files
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 4
- Joined: Fri Jan 18, 2008 10:11 pm
Ant + Saxon9b + multiple files
Oxygen supports applying a XSL transform to a directory of files, but in doing so, it invokes a separate instance of the transform engine for each file, adding a large amount of overhead.
In contacting Oxygen tech support about this, I was recommended to use Ant as a solution. I am posting the results here in the hope that it will be helpful to someone in the same situation (make changes to xsl, run on all files and check output to see if output is as expected).
First, Ant needs to be installed: http://ant.apache.org/manual/install.html#getting
Then an Ant build file needs to be created in the project directory. This is the one I used.
Note: the extension attribute specifies the output file extension.
Then, create a custom External Tool in Oxygen: Tools > External Tools > Preferences > New
Insert this text into the command line field:
ant.bat -f ${pd}\<name-of-ant-buildfile> -Dsourcefiles=${cfd} -Ddestdir="<destination-directory>" -Dstylesheet=${pd}\<stylesheet-to-use>.xsl -Doxy_dir=${oxygenInstallDir}
To do a batch transformation, open a file in the source directory and execute the custom External Tool command that you created.
Speed difference for transforming 278 files with Saxon 9B:
Oxygen batch transform: 1 minute 30 seconds
Ant: 4 seconds
And Oxygen has autocomplete for Ant files. Just make a new xml file with <project> as the root element.
-Caleb
In contacting Oxygen tech support about this, I was recommended to use Ant as a solution. I am posting the results here in the hope that it will be helpful to someone in the same situation (make changes to xsl, run on all files and check output to see if output is as expected).
First, Ant needs to be installed: http://ant.apache.org/manual/install.html#getting
Then an Ant build file needs to be created in the project directory. This is the one I used.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<project default="cleanup">
<target name="cleanup">
<xslt
basedir="${sourcefiles}"
destdir="${destdir}"
extension="htm"
includes="*.htm"
style="${stylesheet}"
classpath="${oxy_dir}\lib\saxon9.jar"
></xslt>
</target>
</project>
Then, create a custom External Tool in Oxygen: Tools > External Tools > Preferences > New
Insert this text into the command line field:
ant.bat -f ${pd}\<name-of-ant-buildfile> -Dsourcefiles=${cfd} -Ddestdir="<destination-directory>" -Dstylesheet=${pd}\<stylesheet-to-use>.xsl -Doxy_dir=${oxygenInstallDir}
To do a batch transformation, open a file in the source directory and execute the custom External Tool command that you created.
Speed difference for transforming 278 files with Saxon 9B:
Oxygen batch transform: 1 minute 30 seconds
Ant: 4 seconds
And Oxygen has autocomplete for Ant files. Just make a new xml file with <project> as the root element.
-Caleb
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service