Thursday, 05 Jun 2008
Thursday, 05 Jun 2008
I would like to announce the availability of a new tool called “odfxsltrunner” as part of the ODF Toolkit project. “odfxsltrunner” is a small Java command line tools that allows you to apply an XSLT stylesheet to an ODF document without extracting the streams like content.xml from the ODF package, and without having to update the ODF packages files with the result of the transformation.
By default, “odfxsltrunner” takes a style sheet and an ODF document as input, applies the stylesheet to the content.xml, and either prints the result on standard output, or stores it in a new file which is a copy of the input file, but where the content.xml is replaced with the result of the transformation. “odfxsltrunner” has a couple of options that modify this behavior. The “-i” option for instance allows you to take a plain XML file as input. This is useful if you want to create a content.xml from scratch that shall be added to an existing template ODF file. The opposite is also possible. The “-o” option can be used to store the result of the transformation in a plain file rather than an ODF package file. This is useful if the result is let's say HTML. Some more options do exist, including of cause one that allows to use a different stream than content.xml as source of the transformation. A detailed explanation of all options can be found in the Wiki. This page also explains where to get “odfxsltrunner”, and how to build and run it.
“odfxsltrunner” uses ODFDOM for the ODF package handling, and the XSLT functionality of the javax.xml.transform package.
I have developed this application in the context of my work in the OASIS OpenDocument Technical Committee. I'm frequently applying XSLT stylesheets to the ODF specification, that is of cause an ODF document itself. For instance, I use XSLT to create cross-references or to run consistency checks. In the past I've used NetBeans to extract and compress ODF documents and to apply the stylesheets. This worked well, but I thought it may be a little bit more user-friendly to have a tool for this. So, this tool more or less reflects what I need there. It should not be considered to be finished or a real product. So, you use the tool on your own risk. I've made it available in the ODF toolkit anyway because I think it may be useful for others, too. However, I will add functionality if I need it, and will resolve bugs I find. Contributions to the tool are of cause welcome.
tags: odf opendocument openoffice.org xslt
That's really interesting, I am developping the very same feature! As mine isn't finished, I'll give yours a try.
Thanks!
Posted by Bruno Verachten on June 05, 2008 at 03:00 PM CEST #