XProc サブパイプラインを指定された回数繰り返したいと思います。(私のユースケースでは、サブパイプラインは、以前に作成された .tex ファイルに対して LaTeX を実行する exec-step で構成されています)
私のコードの簡略化されたバージョンは次のようになりますが、これまでのところ結果はありません。
<p:declare-step version="1.0"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step">
<p:option name="latex-exec" select="'uri/latex'"/>
<p:option name="latex-repeat" select="3"/>
<p:option name="tmp-path" select="'uri/tmp/'"/>
<p:option name="tmp-file" select="'tmp'"/>
<!-- pre-processing -->
<p:for-each>
<p:iteration-source select="(1 to $latex-repeat)"/>
<p:exec result-is-xml="false">
<p:with-option name="command" select="$latex-exec"/>
<p:with-option name="args" select="string-join(('-interaction=nonstopmode','-halt-on-error','-output-format=pdf',concat('-output-directory=',$tmp-path),concat($tmp-path,$tmp-file,'.tex')),' ')"/>
<p:input port="source">
<p:empty/>
</p:input>
</p:exec>
</p:for-each>
p:iteration-source 要素の XPath-2.0 式の問題かどうかはわかりません。ただし、以下は機能し、正しい結果 "Message: 3" が得られます。
<cx:message>
<p:with-option name="message" select="count((1 to $latex-repeat))"/>
<p:input port="source">
<p:empty/>
</p:input>
</cx:message>
私の exec-step は for-each ループの外でテストされ、機能します。Oxygen 16.0でCalabashを使用しています。