Port Binding

Ports have to be bound with their corresponding sources. An input port requires its source documents and for an output port it has to be defined to which step or pipeline output it belongs. There are several possibilities for binding a port with a data source:

  • The data may originate from the output of a previous step.
  • They can be directly defined by <p:inline> or originate from a document sequence.
  • They can also be bound by an external file (a URI e.g. with <p:document>).
  • They can be explicitly empty (e.g. by <p:empty>).

p:pipe

With <p:pipe> ports are bound explicitly with ports of a preset step. The attributes “step“ and “port“ indicate the name of the step or port from which the data to be received originate.

<p:pipe
  step = NCName
  port = NCName/>

Example

The following example shows the standard procedure with <p:pipe>.

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0" name="BeispielPipeline">
  <p:input port="source">
    <p:inline>
      <doc>Hello World</doc>
    </p:inline>
  </p:input>
  <p:output port="result"/>
  <p:identity>
    <p:input port="source">
      <p:pipe port="source" step="ExamplePipeline"/>
    </p:input>
  </p:identity>
</p:declare-step>

The <p:identity> step is being informed by the indication within its "source" input port via <p:pipe> that its input originates from a step with the name “ExamplePipeline“ from the “source“ port. This is the name of the entire pipeline (pipelines are treated like steps). After the execution of this document, the document generated by <p:inline>, <doc>Hello World</doc> is outputted.

<< back next >>