2. The command line

Assuming you have the appropriate jar files on your classpath, you can run XML Calabash like this:

java java-options com.xmlcalabash.drivers.Main xml-calabash-options pipeline.xpl

For example:

$ cd xmlcalabash-1.2.0
$ java -jar xmlcalabash-1.2.0.jar xpl/pipe.xpl
<doc>
Congratulations! You've run your first pipeline!
</doc>

You can use -i port=uri to change the inputs and -o port=file to change the output location.

For example:

$ java -jar xmlcalabash-1.2.0.jar -i source=xpl/pipe.xpl -o result=/tmp/out.xml xpl/pipe.xpl

That will run xpl/pipe.xpl using xpl/pipe.xpl as the input and writing the result to /tmp/out.xml.

If you run java -jar xmlcalabash-1.2.0.jar with no options, it will print a short usage summary.

Throughout this book, we assume that the command calabash will run Java with the correct class path and other arguments.

In all its gory detail, the following synopsis describes the XML Calabash command line:

calabash [ { -P | --saxon-processor } { he | pe | ee } ] [--saxon-configuration file] [ { -a | --schema-aware } ] [ { -D | --debug } ] [--show-messages] [ { -v | --version } ] [--profile file] [ { -S | --safe-mode } ] [ { -c | --config } configfile ] [ { -G | --log-style } { off | plain | wrapped | directory } ]
[ { -E | --entity-resolver } className ] [ { -U | --uri-resolver } className ] [ { -X | --extension } { general-values | xpointer-on-text | { use-xslt-1.0 | use-xslt-10 } | transparent-json | json-flavor=flavor } ...]
[ { -b | --binding } prefix=uri ...] [ { -p | --with-param } [port@]param=value ...]
[ { -i | --input } [port=]uri ...] [ { -d | --data-input } [contentType@] [port=]uri ...] [ { -o | --output } [port=]uri ...] [option=value...]
[[ [ { -l | --library } library.xpl ...] [ [ { -p | --with-param } [port@]param=value ...] [ { -i | --input } [port=]uri ...] [ { -d | --data-input } [port=]uri ...] [ { -s | --step } steptype ...] [option=value...] ...] ] | [ pipeline-uri [option=value...] ]]

See Chapter 4, Configuration for a description of these arguments and what they mean.

There are three different ways to select the pipeline to run: you can specify the URI of the pipeline document on the commandline, you can specify one or more step types on the commandline, or you can specify the URI of the pipeline document in the configfile.