- From: Norman Walsh <ndw@nwalsh.com>
- Date: Tue, 02 Mar 2010 17:05:03 -0500
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2d3zm1isw.fsf@nwalsh.com>
Hi folks, It turns out the XML Calabash code base isn't really factored quite correctly for running atomic steps from the command line. So, while I could make "-s p:identity" work, making steps that took parameters and options work was going to be significantly more work. The XML Calabash driver class really expects to be running a compound step, not an atomic one. Instead of fixing this bug, I decided to turn it into a feature :-) The only really new thing (aside from a couple of bug fixes) in 0.9.18 is support for simple, linear pipelines from the command line. The basic idea is that you list each of the steps with the -s option. You can precede each step with its inputs and parameters and follow it with its options. For example, to run an XSLT step, you could do something like this: $ java com.xmlcalabash.drivers.Main \ -isource=doc.xml -istylesheet=style.xsl -s p:xslt To validate the input then process it with XSLT, like this: $ java com.xmlcalabash.drivers.Main \ -isource=doc.xml -ischema=schema.xsd -s p:validate-with-xml-schema \ -istylesheet=style.xsl -s p:xslt The way this works is by constructing a literal pipeline from the steps passed on the command-line and then running that pipeline. If you run with the --debug option, you can see the pipeline that was constructed. This strikes me as having a couple of really nice benefits. 1. It means I don't have to do a big refactoring exercise right now. 2. It means I have a uniform command-line API to a whole bunch of XML technologies. I'll never fuss again about how to validate, or do XInclude, or XSLT, or XQuery, from the command line. 3. It means a lot of simple pipelines can be invoked without ever actually writing them down. Given that it's not practical to have both the primary input document and the pipeline as "stdin" simultaneously, I think this is going to be a big win when integrating XML Calabash into shell scripts and the like. Give it a whirl and let me know what you think. Especially if you discover I've totally broken some aspect of command line parsing :-/ Be seeing you, norm -- Norman Walsh <ndw@nwalsh.com> | Wisdom is only a comparative quality, http://nwalsh.com/ | it will not bear a single | definition.--Marquess of Halifax
Received on Tuesday, 2 March 2010 22:05:40 UTC