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

XProc 1.0 uses p:input for three distinct purposes:

  1. to declare the document input ports of a step
  2. to declare the parameter input ports of a step
  3. to connect document input ports of a declared step
The following examples illustrate the distinction between a document input port declaration and a document input port connection.

<p:declare-step version="1.0"> <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"> <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.