Re: using XProc and Calabash to process multiple files

Hi Robert,

I'm only an amateur xproctologist myself. Perhaps an actual expert will
chime in with better advice, but here are my thoughts:

I never had any luck getting the calabash ant task to work. When I
invoke calabash from ant, I just use the <java> task. Since I've never
used the calabash task, I don't know how it is designed to work when
given a set of files. Will it really run each one through the pipeline?
Does your code work if there is only one file in that directory? Like I
said, I've never gotten that task to work so I can't say.

If I were doing this, I would put everything in XProc. In this case, I
might use the xpath collection() function inside the pipeline to find
all the files in the target directory, then use p:for-each with
p:iteration-source to loop over the result and operate on each file,
using p:store to store the result. In this case, the input and output of
the pipeline would be irrelevant. If you use Ant at all, it would just
be as a wrapper from which to call Calabash.



On 5/15/20 5:02 PM, Robert Stuart wrote:
> My final goal is to process many Docbook instances and produce the FO using the Docbook XSL 2 Stylesheets.  My simple stepping stone that does not work was to run the identity Xproc step on multiple files.
> It appears to run until right after it hits the last file in the first directory child of examples. I get output files to out corresponding to the input files. BUT I then get the following error and it chokes. If some kind soul would point me in the right direction I would really appreciate it. If for some reason extending this simple yet not yet working example to the pipeline docbook-xslt2-2.6.0/xslt/base/pipelines/db2fo.xpl will not work for some reason help there would be appreciated.
> Environment info:
> xmlcalabash-1.2.1-99.jar
> OS X 10.14.6
> java Corretto-
> saxon SaxonHE9-9-1-7J
> build.xml:58: com.xmlcalabash.core.XProcException: Duplicate output binding for default output port.
>  at com.xmlcalabash.util.UserArgs.addOutput(
>  at com.xmlcalabash.drivers.CalabashTask.process(
>  at com.xmlcalabash.drivers.CalabashTask.execute(
>  at
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>  at java.lang.reflect.Method.invoke(
>  at
>  at
>  at
>  at
>  at
>  at
>  at
>  at
>  at
>  at
>  at
>  at
> Total time: 11 seconds
> <?xml version="1.0" encoding="UTF-8"?>
> <p:declare-step xmlns:p=""
>   xmlns:c="" version="1.0">
>   <p:input port="source"/>
>   <p:output port="result"/>
>   <p:identity/>
> </p:declare-step>
> Using an ant task
>   <target name="test2Calabash">
>       <calabash  includes="**/*.xml"
>           basedir="${examples.dir}/"
>           destdir="${generatedReports.dir}/out">
>           <pipeline>
>               <file file="${basedir}/XPROC/identity.xpl" />
>           </pipeline>
>       </calabash>
>   </target>
> Note for ant I did end up having to add a taskdef  since only adding typedef didn’t seem to do it for me.
> <taskdef resource="com/xmlcalabash/antlib.xml">
>       <classpath>
>           <pathelement location="${deps.static}/xmlcalabash-1.2.1-99/xmlcalabash-1.2.1-99.jar"/>
>       </classpath>
>   </taskdef>

Received on Monday, 18 May 2020 20:53:59 UTC