xproc / 1.0-specification

The 1.0 XProc specification and now abandoned drafts of a 2.0 XML specification
12 stars 6 forks source link

3.10.3 Additional steps and enhancements: p:eval #56

Open ndw opened 10 years ago

ndw commented 10 years ago

The vocabulary of steps available in XProc is extensible. Users and implementors have developed additional steps. For example, to support pipelines that produce EPUB documents or manipulate files on disk. It is worth considering which, if any, new steps should be elevated to the XProc namespace. The candidates include, but are not limited to:

p:eval

ndw commented 9 years ago

Proposal 1:

New compound step; you can't (in this simple example) map port names.

<ex:generate-pipeline name="gentoc">
  <!-- source (primary), banana -->
  <!-- result (primary), toc -->
</ex:generate>

<ex:make-body name="body"/>

<p:xproc>
  <p:input>
    <p:pipe step="gentoc"/>
  </p:input>
  <p:input port="source">
    <p:pipe/>
  </p:input>
  <p:input port="banana">
    <p:pipe step="fruit"/>
  </p:input>
  <p:output port="result"/>
  <p:output port="toc"/>
</p:xproc>

<p:do-something-with-book>
  <p:input port="toc">
    <p:pipe port="toc"/>
  </p:input>
  <p:input port="body">
    <p:pipe port="result"/>
  </p:input>
</p:do-something-with-book>
ndw commented 9 years ago

Proposal 2:

Vanilla atomic step, but verbose. (And relies on making p:document-properties() work!)

<ex:generate-pipeline name="gentoc">
  <!-- source (primary), banana -->
  <!-- result (primary), toc -->
</ex:generate>

<ex:make-body name="body"/>

<p:for-each name="multiplex">
  <p:input>
    <p:pipe step="fruit"/>
  </p:input>
  <p:set-properties properties="map { 'port', 'banana' }"/>
</p:for-each>

<p:xproc>
  <p:input port="pipeline">
    <p:pipe step="gentoc"/>
  </p:input>
  <p:input port="inputs">
    <p:pipe step="body"/>
    <p:pipe step="multiplex"/>
  </p:input>
</p:xproc>

<p:split-sequence test="p:document-properties(.)('port') = 'toc'"/>

<p:do-something-with-book>
  <p:input port="toc">
    <p:pipe port="matched"/>
  </p:input>
  <p:input port="body">
    <p:pipe port="not-matched"/>
  </p:input>
</p:do-something-with-book>
htInEdin commented 9 years ago

Proposal 3: New compound step, supports renaming ports (dynamically if @sub allows AVTs) (For background to all these, see http://www.ltg.ed.ac.uk/~ht/xproc_step.html )

<ex:generate-pipeline name="gentoc">
  <!-- source (primary), banana -->
  <!-- result (primary), toc -->
</ex:generate>

<ex:make-body name="body"/>

<p:xproc>
  <p:input port="pipeline">
    <p:pipe step="gentoc"/>
  </p:input>
  <p:input sub="banana">
    <p:pipe step="fruit"/>
  </p:input>
  <p:output sub="toc" super="utoc"/>
</p:xproc>

<p:do-something-with-book>
  <p:input port="toc">
    <p:pipe port="utoc"/>
  </p:input>
</p:do-something-with-book>