I have an XProc step where I would like the input source to work like this:
- if a URL is provided on the command line using
-isource=foo.xml
, then the document at that URL is used as the source document;
- if no URL is provided, then the document
default.xml
should be used.
Is it possible to obtain this behaviour in XProc?
As suggested by Florent on the XProc mailing list, using a p:document inside the p:input works just fine as a default. Specifying something else from outside simply overrides it:
<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc"
name="main">
<p:input port="source">
<p:document href="default.xml"/>
</p:input>
<p:output port="result"/>
<p:identity/>
</p:declare-step>
Run it with:
calabash test.xpl
and:
calabash --input source=myinput.xml test.xpl
to see the difference..
HTH!