David Maus

Today I Learned: The different uses of p:input in XProc 1.0

Update 16th September 2017 08:56: Turns out that I am not the only one who struggles (a little bit, compared to the rest of XProc) with using one and the same name for different things. After a short discussion in Aachen we agreed to rename p:input to p:with-input when it is used as document input port connection.

XProc 1.0 uses p:input for three distinct purposes:

The following examples illustrate the distinction between a document input port declaration and a document input port connection.

<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc">  <p:sink>    <p:input port="source">      <p:inline>        <foobar/>      </p:inline>    </p:input>  </p:sink></p:declare-step>

The pipeline has a single step p:sink whose source input port is connected to a p:inline that provides an inline document. The p:input acts as a document input port connection.

<p:declare-step version="1.0" name="main" xmlns:p="http://www.w3.org/ns/xproc">  <p:input port="source">    <p:inline>      <foobar/>    </p:inline>  </p:input>  <p:sink>    <p:input port="source">      <p:pipe step="main" port="source"/>    </p:input>  </p:sink></p:declare-step>

Here we have two p:input elements. The first is a document input port declaration with a default connection to an inline document provider. The second input is a document input port connection and connects the source input port of the p:sink to the pipeline's declared input port, i.e. the first p:input. Observe that this required the pipeline to have a name to specify the connection target in p:pipe.

One practical difference between the two is, that the inlined document is fixed in the first case, while it can be overridden in the second. It might also be worth noting that there are two other pipeline elements that as document input port connection, p:iteration-source and p:viewport-source.