<?xml version="1.0" encoding="UTF-8"?>
<!--
<?publication-root http://www.w3.org/XML/XProc/docs/?>
<?latest-version http://www.w3.org/XML/XProc/docs/langspec.html?>
-->
<!DOCTYPE specification [
<!ENTITY % entities SYSTEM "langspec.ent">
<!ENTITY atom "atomic step">
<!ENTITY Atom "Atomic step">
<!ENTITY atoms "atomic steps">
<!ENTITY Atoms "Atomic steps">
<!ENTITY kind "type">
<!ENTITY container "container">
<!ENTITY containers "containers">
<!ENTITY Containers "Containers">
<!ENTITY construct "step">
<!ENTITY constructs "steps">
<!ENTITY Constructs "Steps">
<!ENTITY stage "step">
<!ENTITY stages "steps">
<!ENTITY Stage "Step">
<!ENTITY Stages "Steps">
<!ENTITY env-standard-update "
<!--
<listitem>
<para>All of the <glossterm>declared inputs</glossterm> of the step
are added to the <glossterm>readable ports</glossterm> in the environment.</para>
</listitem>
-->
<listitem>
<para>The union of all the declared outputs of the
<glossterm>contained &stages;</glossterm> are added to the
<glossterm>readable ports</glossterm> in the environment.</para>
</listitem>
<listitem>
<para>All of the <glossterm>declared parameters</glossterm> of the step
are added to the
<glossterm>in-scope parameters</glossterm> in the environment.</para>
</listitem>
<listitem>
<para>If any ignored namespaces are specified, those
namespaces are added to the set of
<glossterm>ignored namespaces</glossterm> in the
environment.</para>
</listitem>">
<!ENTITY env-default-input-update "
<listitem>
<para>If there is a preceding sibling &stage; element and that preceding sibling
has exactly one output port, or an output port designated as the default, then
that output port becomes the <glossterm>default readable port</glossterm>.</para>
</listitem>">
<!ENTITY component "component">
]>
<specification xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:cs="http://www.w3.org/XML/XProc/2006/04/components#" xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" class="wd" version="5.0-extension w3c-xproc">
<info>
<title>XProc: An XML Pipeline Language</title>
<w3c-shortname>xproc</w3c-shortname>
<pubdate>2007-04-05</pubdate>

<bibliorelation type="isformatof" xlink:href="langspec.xml">XML</bibliorelation>
<!--
<bibliorelation type="isformatof"
		xlink:href="diff.html">Revision markup</bibliorelation>
-->

<bibliorelation type="replaces" xlink:href="http://www.w3.org/TR/2006/WD-xproc-20061117/"/>
<bibliorelation type="replaces" xlink:href="http://www.w3.org/TR/2006/WD-xproc-20060928/"/>

<authorgroup>
  <author>
    <personname>Norman Walsh</personname>
    <affiliation>
      <orgname>Sun Microsystems, Inc.</orgname>
    </affiliation>
    <email>Norman.Walsh@Sun.COM</email>
  </author>
  <author>
    <personname>Alex Milowski</personname>
    <affiliation>
      <orgname>Invited expert</orgname>
    </affiliation>
    <email>alex@milowski.org</email>
  </author>
</authorgroup>
  
<abstract>
<para>This specification describes the syntax and semantics of
<citetitle>XProc: An XML Pipeline Language</citetitle>, a language
for describing operations to be performed on XML documents.
</para>

<para>An XML Pipeline specifies a sequence of operations to be
performed on one or more XML documents, producing one or more XML
documents as output.</para>
</abstract>

<legalnotice role="status">

<para><emphasis>This section describes the status of this document at
the time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest revision
of this technical report can be found in the <link xlink:href="http://www.w3.org/TR/">W3C technical reports index</link>
at http://www.w3.org/TR/.</emphasis></para>

<para>This document was produced by the
<link xlink:href="http://www.w3.org/XML/Processing/">XML Processing Model Working Group</link>
which is part of the
<link xlink:href="http://www.w3.org/XML/Activity">XML Activity</link>.
Publication as a Working Draft does not imply endorsement
by the W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in progress.
</para>

<para>This is a public Working Draft. This draft addresses many, but
not all, of the design questions that were incomplete in previous
drafts. The library of standard steps, both required and optional, is
still being reviewed and considered. The Working Group continues to
encourage feedback from potential users. No useful revision marks from
the previous Working Draft are available due to significant editorial
reorganization of the material.</para>

<para>Please send comments about this document to
<link xlink:href="mailto:public-xml-processing-model-comments@w3.org">public-xml-processing-model-comments@w3.org</link> (public
<link xlink:href="http://lists.w3.org/Archives/Public/public-xml-processing-model-comments/">archives</link> are available).</para>

<para>This document was produced by a group operating under the
<link xlink:href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</link>.
W3C maintains a
<link xlink:href="http://www.w3.org/2004/01/pp-impl/38398/status">public list of any patent disclosures</link>
made in connection with the deliverables of the group; that page also
includes instructions for disclosing a patent. An individual who has
actual knowledge of a patent which the individual believes contains
<link xlink:href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</link>
must disclose the information in accordance with
<link xlink:href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</link>.
</para>

</legalnotice>
</info>

<section xml:id="introduction">
<title>Introduction</title>

<!-- EDNOTE: the "implementation defined" nature of external
inputs and outputs belongs in a normative section -->

<para>An XML Pipeline specifies a sequence of operations to be
performed on a collection of XML input documents. Pipelines take zero or more
XML documents as their input and produce zero or more XML documents as
their output.</para>

<para>A pipeline consists of &stages;. Like
pipelines, &stages; take zero or more XML documents as their input
and produce zero or more XML documents as their output. The inputs to
a &stage; come from the web, from the pipeline document, from the inputs to the
pipeline itself, or from the outputs of other &stages; in the pipeline. The outputs
from a &stage; are consumed by other &stages;, are outputs of the pipeline as
a whole, or are discarded.</para>

<para>There are two kinds of &stages;: &atoms; and compound
&constructs;. &Atoms; carry out single operations and have no
substructure as far as the pipeline is concerned, whereas compound &constructs;
include &stages; within themselves.</para>

<para>This specification defines a standard library,
<xref linkend="std-components"/>, of &stages;.
Pipeline implementations <rfc2119>may</rfc2119> support additional types of
&stages; as well.</para>

<para><xref linkend="fig-xival"/> is a graphical representation of a
simple pipeline that performs XInclude processing and validation on a
document.</para>

<figure xml:id="fig-xival">
<title>A simple, linear XInclude/Validate pipeline</title>
<mediaobject>
<alt>A simple, linear XInclude/Validate pipeline</alt>
<imageobject>
<imagedata fileref="graphics/sch-xinclude-validate-pipeline.png"/>
</imageobject>
</mediaobject>
</figure>

<para>This is a pipeline that consists of two &atoms;, XInclude and
Validate. The pipeline itself has two inputs, “Document” and “Schema”.
How these inputs are connected to XML documents outside the pipeline
is implementation-defined.
The XInclude &stage; reads the pipeline input “Document” and produces a result
document. The Validate &stage; reads the pipeline input “Schema” and
the output from the XInclude &stage; and produces a
result document. The result of the validation, “Result Document”,
is the result of the pipeline.
How pipeline outputs are connected to XML documents outside the pipeline is
implementation defined.</para>

<para>The pipeline document for this pipeline is shown in
<xref linkend="ex1"/>.</para>

<example xml:id="ex1">
<title>A simple, linear XInclude/Validate pipeline</title>
<programlisting>&lt;p:pipeline xmlns:p="http://www.w3.org/2007/03/xproc"&gt;
  &lt;p:input port="source" sequence="no"/&gt;
  &lt;p:input port="schemaDoc" sequence="yes"/&gt;
  &lt;p:output port="result" sequence="no"/&gt;

  &lt;p:xinclude name="s1"&gt;
    &lt;p:input port="source"&gt;
      &lt;p:pipe step="fig1" port="source"/&gt;
    &lt;/p:input&gt;
  &lt;/p:xinclude&gt;

  &lt;p:validate-xml-schema name="s2"&gt;
    &lt;p:input port="schema"&gt;
      &lt;p:pipe step="fig1" port="schemaDoc"/&gt;
    &lt;/p:input&gt;
  &lt;/p:validate-xml-schema&gt;
&lt;/p:pipeline&gt;
</programlisting>
</example>

<para><xref linkend="fig-style-proc"/> is a more complex example: it
performs schema validation with an appropriate schema and then styles
the validated document.</para>

<figure xml:id="fig-style-proc">
<title>A validate and transform pipeline</title>
<mediaobject>
<alt>A validate and transform pipeline</alt>
<imageobject>
<imagedata fileref="graphics/sch-transform.png"/>
</imageobject>
</mediaobject>
</figure>

<para>The heart of this example is the conditional. The  “choose”
&construct; evaluates an XPath expression over a test document. Based on the
result of that expression, one or another branch is evaluated. In this example,
each branch consists of a single validate &stage;.</para>

<example xml:id="ex2">
<title>A validate and transform pipeline</title>
<programlisting>&lt;p:pipeline xmlns:p="http://www.w3.org/2007/03/xproc"&gt;
  &lt;p:input port="source" sequence="no"/&gt;
  &lt;p:output port="result" sequence="no"/&gt;

  &lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;p&gt;This is documentation&lt;/p&gt;
  &lt;/div&gt;

  &lt;p:choose name="vcheck"&gt;
    &lt;p:when test="/*[@version &amp;lt; 2.0]"&gt;
      &lt;p:output port="valid"/&gt;
      &lt;p:validate-xml-schema name="val1"&gt;
	&lt;p:input port="schema"&gt;
	  &lt;p:document href="v1schema.xsd"/&gt;
	&lt;/p:input&gt;
      &lt;/p:validate-xml-schema&gt;
    &lt;/p:when&gt;

    &lt;p:otherwise&gt;
      &lt;p:output port="valid"/&gt;
      &lt;p:validate-xml-schema name="val2"&gt;
	&lt;p:input port="schema"&gt;
	  &lt;p:document href="v2schema.xsd"/&gt;
	&lt;/p:input&gt;
      &lt;/p:validate-xml-schema&gt;
    &lt;/p:otherwise&gt;
  &lt;/p:choose&gt;

  &lt;p:xslt name="xform"&gt;
    &lt;p:input port="stylesheet"&gt;
      &lt;p:document href="stylesheet.xsl"/&gt;
    &lt;/p:input&gt;
  &lt;/p:xslt&gt;
&lt;/p:pipeline&gt;
</programlisting>
</example>

</section>

<section xml:id="pipeline-concepts">
<title>Pipeline Concepts</title>

<para><termdef xml:id="dt-pipeline">A <firstterm>pipeline</firstterm>
is a set of &stages; connected
together, with outputs flowing into inputs, without any loops (no &stage; can
read its own output, directly or indirectly).</termdef>
A pipeline is itself a
<glossterm>&stage;</glossterm> and must satisfy the constraints on
&stages;.</para>

<para>The result of evaluating a pipeline is the result of evaluating
the &stages; that it contains, in the order determined by the connections
between them. A pipeline must behave as if it
evaluated each &stage; each time it occurs. Unless otherwise
indicated, implementations <rfc2119>must not</rfc2119> assume that
&stages; are functional (that is, that their outputs depend only on
their explicit inputs, options, and parameters) or side-effect free.</para>

<section xml:id="stages">
<title>&Stages;</title>

<para><termdef xml:id="dt-step">A <firstterm>&stage;</firstterm> is
the basic computational unit of a pipeline.
&Stages; are either atomic or compound.</termdef>
<termdef xml:id="dt-atomic-step">An <firstterm>atomic &stage;</firstterm> is a
&stage; that performs a unit of XML processing, such as XInclude or
transformation.</termdef> Atomic &stages; can perform arbitrary
amounts of computation but they are indivisible. Atomic &stages; carry out fundamental
XML operations. An XSLT &stage;, for example, performs XSLT processing;
an XML Schema Validation &stage; validates one input with respect to some set
of XML Schemas, etc.</para>

<para>Compound &stages;, on the other hand, control and organize the flow of
documents through a pipeline, reconstructing familiar programming
language functionality such as conditionals, iterators and exception
handling. They contain other &stages;, whose evaluation
they control.</para>

<para><termdef xml:id="dt-compound-step">A
<firstterm>compound &stage;</firstterm> is a &stage; that
contains additional &stages;. That is, a compound &stage; differs from an
atomic &stage; in that its semantics are at least partially determined by the
&stages; that it contains.</termdef></para>

<para>Every compound &stage; contains zero or more &stages;.
<termdef xml:id="dt-contained-steps">The &stages; that occur
directly inside a compound &stage;
are called <firstterm>contained &stages;</firstterm>.</termdef>
<termdef xml:id="dt-container">A compound &stage; which immediately
contains another &stage; is called its <firstterm>&container;</firstterm>.</termdef>
</para>

<para><termdef xml:id="dt-subpipeline">The &stages; (and the
connections between them) within a compound step form a
<firstterm>subpipeline</firstterm>.</termdef>
<termdef xml:id="dt-last-step">The <firstterm>last step</firstterm> in a
subpipeline is the last step in document order within its container.
</termdef></para>

<para>A compound &stage; can contain one or more subpipelines and it
determines how, and which, if any, of its subpipelines are
evaluated.</para>

<para>&Stages; have “ports” into which inputs and outputs are
connected. Each &stage; has a number of input ports and a number of
output ports, all with unique names. A &stage; can have zero input
ports and/or zero output ports.
(All &stages; have an implicit standard output port for
reporting errors that <rfc2119>must not</rfc2119> be declared.)
</para>

<para>&Stages; have any number of options, all with unique names.
A &stage; can have zero options.</para>

<para>&Stages; have any number of parameters, all with unique names.
A &stage; can have zero parameters.</para>
</section>

<section xml:id="input-output">
<title>Inputs and Outputs</title>

<para>Although some &stages; can read and write non-XML resources,
what flows <emphasis>between</emphasis> &stages; through
input ports and output ports are exclusively XML documents or sequences of XML
documents. Each XML document (or document in a sequence) must conceptually be
an <biblioref linkend="xml-infoset-rec"/> with a <emphasis>Document
Information Item</emphasis> at its root. The inputs and outputs can be
implemented as sequences of characters, events, or object models, or any other
representation the implementation chooses.</para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm> if a non-XML
resource is produced on a &stage; output or arrives on a &stage;
input.</phrase></para>

<note role="editorial" xml:id="non-xml-not-detected">
<para>What about the cases where it's impractical to test for this error?</para>
</note>

<para>An implementation <rfc2119>may</rfc2119> make it possible for a
&stage; to produce non-XML output (through channels other than a named
output port)—for example, writing a PDF
document to disk—but that output cannot flow through the pipeline. Similarly,
one can imagine a &stage; that takes no pipeline inputs, reads a non-XML file
from a URI, and produces an XML output. But the non-XML file cannot arrive
on an input port to a &stage; or pipeline.</para>

<para>The common case is that each step has one or more inputs and
one or more outputs. <xref linkend="fig-atomic-step"/> illustrates symbolically
an atomic step with two inputs and one output.</para>

<figure xml:id="fig-atomic-step">
<title>An atomic step</title>
<mediaobject>
<alt>An atomic step with two inputs and one output</alt>
<imageobject>
<imagedata fileref="graphics/atomic-step.png"/>
</imageobject>
</mediaobject>
</figure>

<para>Each &stage; declares its input and output ports.
<termdef xml:id="dt-declared-inputs">The input ports declared on a
&stage; are its <firstterm>declared inputs</firstterm>.</termdef>
<termdef xml:id="dt-declared-outputs">The output ports declared on a
&stage; are its <firstterm>declared outputs</firstterm>.</termdef></para>

<para>All of the <glossterm>declared inputs</glossterm> of a &stage;
(atomic or compound) must be connected. Inputs may be connected
to:</para>

<itemizedlist>
<listitem>
<para>The output port of some other &stage;.</para>
</listitem>
<listitem>
<para>A fixed, inline document or sequence of documents.</para>
</listitem>
<listitem>
<para>A document read from a URI.</para>
</listitem>
<listitem>
<para>The inputs declared on the top-level [[pipeline]] &stage;, and only
on that &stage;, may be connected to documents outside the pipeline
by an implementation-dependent mechanism.</para>
</listitem>
</itemizedlist>

<para>Unconnected output ports are allowed; any documents produced on
those ports are simply discarded.</para>

<para>For atomic steps, the inputs and outputs are declared once (with
<tag>p:declare-step</tag>) for
each type of atomic step and every instance of that type has the same inputs
and outputs. For example, every XSLT step has exactly the same inputs and
outputs with the same names.</para>

<para>The situation is slightly more complicated for compound steps.
Compound steps don't typically have declared inputs, but they do have
declared outputs. Unlike atomic steps, on compound steps, the number
and names of the outputs can be different on each instance of the
step.</para>

<para><xref linkend="fig-compound-step"/> illustrates symbolically
a compound step with one output. As you can see from the
diagram, the output from the compound step comes from one of the outputs
of the subpipeline within the step.</para>

<figure xml:id="fig-compound-step">
<title>A compound step</title>
<mediaobject>
<alt>A compound step with two inputs and one output</alt>
<imageobject>
<imagedata fileref="graphics/compound-step.png"/>
</imageobject>
</mediaobject>
</figure>

<para>Output ports on compound steps have a dual nature: from the perspective
of the compound step's siblings, it's outputs are just outputs and they can
either be connected up or not. From the perspective of the compound step itself,
they are inputs into which something must be connected.</para>

<para>Within a compound step, the <glossterm>declared outputs</glossterm>
of a compound &stage; can be connected to:</para>

<itemizedlist>
<listitem>
<para>The output port of some other
<glossterm baseform="contained &stages;">contained &stage;</glossterm>.</para>
</listitem>
<listitem>
<para>A fixed, inline document or sequence of documents.</para>
</listitem>
<listitem>
<para>A document read from a URI.</para>
</listitem>
</itemizedlist>

<para>Each step may have a default output port.
<termdef xml:id="dt-default-output-port">If a step has exactly one output port,
or if one of its output ports is explicitly designated as the default, then that output
port is the <firstterm>default output port</firstterm> of the step.</termdef>
If a step has more than one output port and none is explicitly designated the
default, then the default output port of that step is undefined.</para>

<para>Each input and output is declared to accept or produce either a
single document or a sequence of documents. It <emphasis>is
not</emphasis> a static error to connect a port that is declared to
produce a sequence of documents to a port that is declared to accept
only a single document. It is, however, a dynamic error if the former
&stage; actually produces more than a single document at run
time.</para>

<para><termdef xml:id="dt-signature">The
<firstterm>signature</firstterm> of a &stage; is the set of inputs,
outputs, options, and parameters that it is declared to accept.</termdef> Each
atomic &stage; (e.g. XSLT or XInclude) has a fixed signature, declared
globally or built-in, which all its instances share, whereas each
compound &stage; has its own signature declared locally.</para>

<para><termdef xml:id="dt-matches">A &stage;
<firstterm>matches</firstterm> its signature if and only if it specifies
an input for each declared input and it specifies no inputs that are not
declared; it specifies no options that are not declared; it specifies
a parameter for each parameter that is declared to be required; and it
specifies no parameters that are not declared.</termdef>
In other words, every input and required parameter <rfc2119>must</rfc2119> be specified
and only inputs, outputs, options, and
parameters that are declared <rfc2119>may</rfc2119> be
specified. Outputs and optional parameters do not have to be
specified.</para>

<para>&Stages; <rfc2119>may</rfc2119> also produce error, warning, and informative
messages. These messages appear on a special “error output” port defined
(only)
in the catch clause of a <link linkend="p.try">try/catch</link>.</para>
</section>

<section xml:id="parameters">
<title>Options and parameters</title>

<para>Some steps accept options and/or parameters. Both are name/value pairs.
The distinction between options and parameters is simply that options are used
by the XProc processor to configure the step; the step never sees them. Parameters
are passed to the step for its use, the XProc processor does not use them.</para>

<para><termdef xml:id="dt-option">An <firstterm>option</firstterm> is
a name/value pair.</termdef> The name of an option must be an
<link xlink:href="http://www.w3.org/TR/REC-xml-names/#dt-expname">expanded name</link>.
The value of an option must be a string.
If a document, node, or other value is given, its
<biblioref linkend="xpath"/> string value
is computed and that string is used.
</para>

<para><termdef xml:id="dt-declared-options">The options declared on a
&stage; are its <firstterm>declared options</firstterm>.</termdef>
</para>

<para><termdef xml:id="dt-parameter">A <firstterm>parameter</firstterm> is
a name/value pair.</termdef> The name of a parameter must be an
<link xlink:href="http://www.w3.org/TR/REC-xml-names/#dt-expname">expanded name</link>.
The value of a parameter must be a string.
If a document, node, or other value is given, its
<biblioref linkend="xpath"/> string value
is computed and that string is used.
</para>

<para><termdef xml:id="dt-declared-parameters">The parameters declared on a
&stage; are its <firstterm>declared parameters</firstterm>.</termdef>
</para>
</section>

<section xml:id="connections">
<title>Connections</title>

<para>&Stages; are connected together by their input ports and output ports.
<phrase role="err">It is a <glossterm>static error</glossterm> if there are any loops in
the connections between &stages;: no &stage; can be connected to itself
nor can there be any sequence of connections through other &stages; that
leads back to itself.</phrase></para>

</section>

<section xml:id="environment">
<title>Environment</title>

<para><termdef xml:id="dt-environment">The
<firstterm>environment</firstterm> of a &stage; is the static information
available to that &stage;.</termdef></para>

<para>The environment consists of:</para>

<orderedlist>
<listitem>
<para>A set of readable ports.
<termdef xml:id="dt-readable-ports">The
<firstterm>readable ports</firstterm> are the &stage; name/output
port name pairs that are visible to the &stage;.</termdef>
Inputs and outputs can only be connected to
readable ports.</para>
</listitem>
<listitem>
<para>A set of in-scope parameters.
<termdef xml:id="dt-in-scope-parameters">The
<firstterm>in-scope parameters</firstterm> are the set of parameters that
can be read by a &stage;.</termdef> All of the in-scope parameters are
available to the processor for computing actual parameters.
The actual parameters passed to a step
are those that are explicitly identified with <tag>p:parameter</tag> or
<tag>p:import-parameter</tag> tags on the actual step.</para>
</listitem>
<listitem>
<para>A default readable port.
<termdef xml:id="dt-default-readable-port">The <firstterm>default readable port</firstterm>,
which may be undefined, is a specific &stage; name/port name pair from the set of readable
ports.</termdef></para>
</listitem>
<listitem>
<para>A set of ignored namespaces.
<termdef xml:id="dt-ignored-namespaces">The set of <firstterm>ignored
namespaces</firstterm> are the namespaces which do not identify &stages;.</termdef>
</para>
</listitem>
</orderedlist>

<para><termdef xml:id="dt-empty-environment">The
<firstterm>empty environment</firstterm> contains no readable ports,
no in-scope parameters, an undefined default readable port, and an
empty set of ignored namespaces.</termdef>
</para>

<para>Unless otherwise specified, the environment of each step is its
inherited environment, the environment of its parent, with the
following
<phrase xml:id="dt-standard-modifications">standard modifications</phrase>:</para>

<itemizedlist>
<listitem>
<para>All of the <glossterm>declared parameters</glossterm> of the step
are added to the
<glossterm>in-scope parameters</glossterm> in the environment.</para>
</listitem>
<listitem>
<para>If any ignored namespaces are specified, those
namespaces are added to the set of
<glossterm>ignored namespaces</glossterm> in the
environment.</para>
</listitem>
<listitem>
<para>If there is a preceding sibling &stage; element:</para>
<itemizedlist>
<listitem>
<para>If that preceding sibling has exactly one output port,
or an output port designated as the default, then that output port becomes
the <glossterm>default readable port</glossterm>.</para>
</listitem>
<listitem>
<para>Otherwise, the <glossterm>default readable port</glossterm> is undefined.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>If there <emphasis>is not</emphasis> a preceding sibling &stage; element,
the <glossterm>default readable port</glossterm> is unchanged from
its <glossterm>inherited environment</glossterm>.</para>
</listitem>
</itemizedlist>

<para>A step with no parent inherits the <glossterm>empty
environment</glossterm>.</para>

<para>Unless otherwise specified, the
<phrase xml:id="dt-inherited-environment">inherited environment</phrase> for
the <link linkend="dt-contained-steps">contained &stages;</link> of a
compound &stage; is the
<phrase xml:id="dt-standard-inheritance">standard inheritance</phrase>, which
is the environment of that <glossterm>compound &stage;</glossterm>,
with the following modification:</para>

<itemizedlist>
<listitem>
<para>The union of all the declared outputs of the
<glossterm>contained &stages;</glossterm> are added to the
<glossterm>readable ports</glossterm> in the environment.</para>
</listitem>
</itemizedlist>

<para>In other words, sibling steps can see each other's outputs
in addition to the outputs of their ancestors.</para>

</section>
</section>

<section xml:id="syntax">
<title>Syntax Overview</title>

<para>This section describes the normative XML syntax of XProc. This
syntax is sufficient to represent all the aspects of a pipeline, as
set out in the preceding sections.
</para>

<para>The namespace of the XProc XML vocabulary described by this
specification is
<uri type="xmlnamespace">http://www.w3.org/2007/03/xproc</uri>.</para>

<para>Elements in a pipeline document represent the pipeline,
the &stages; it contains, the connections between those &stages;, the &stages;
and connections contained within them, and so on. Each &stage; is represented
by an element; a combination of elements and attributes specify
how the inputs and outputs of each &stage; are connected and how options and parameters
are passed.</para>

<para>Conceptually, we can speak of &stages; as objects that have
inputs and outputs, that are connected together and which may
contain additional &stages;. Syntactically, we need a mechanism
for specifying these relationships.</para>

<para><glossterm baseform="container">Containment</glossterm> is
represented naturally using nesting of XML elements. If a particular element
identifies a <glossterm>compound &stage;</glossterm> then the &stage; elements that
are its immediate children form its <glossterm>subpipeline</glossterm>.</para>

<para>The connections
between &stages; are expressed using names and references to those
names.</para>

<para>Six kinds of things are named in XProc:</para>

<orderedlist>
<listitem>
<para>&Stages; types,</para>
</listitem>
<listitem>
<para>&Stages;,</para>
</listitem>
<listitem>
<para>Input ports,</para>
</listitem>
<listitem>
<para>Output ports,</para>
</listitem>
<listitem>
<para>Options, and</para>
</listitem>
<listitem>
<para>Parameters</para>
</listitem>
</orderedlist>

<section xml:id="scoping">
<title>Scoping of Names</title>

<para>The scope of the names of &stage; types is the pipeline. Each pipeline
processor has some number of built in &stage; types and may declare
(directly, or by reference to an external library) additional &stage; types.
</para>

<para>The scope of the names of the &stages; themselves is determined
by the <glossterm>environment</glossterm> of each &stage;. In general,
the name of a &stage;, the names of its sibling &stages;, the
names of any &stages; that it contains directly, the names of its
ancestors; and the names of its ancestor's siblings are all in the same scope.
<phrase role="err">All in-scope &stages; <rfc2119>must</rfc2119> have unique names: it is
a <glossterm>static error</glossterm> if two &stages; with the same
name appear in the same scope.</phrase></para>

<para>The scope of an input or output port name is the &stage; on
which it is defined. The names of all the ports on any &stage;
<rfc2119>must</rfc2119> be unique.</para>

<para>Taken together, these uniqueness constraints guarantee that the
combination of a &stage; name and a port name uniquely identifies
exactly one port on exactly one in-scope &stage;.</para>

<para>The scope of option names is the &stage; on which they appear.
</para>

<para>The scope of parameter names is essentially the same as the
scope of &stage; names, with the following caveat. Whereas &stage;
names must be unique, parameter names may be repeated. The declaration
of a parameter on a &stage; shadows any declaration that may already
be in-scope.</para>
</section>

<section xml:id="global-attributes">
<title>Global Attributes</title>

<para>The following attributes <rfc2119>may</rfc2119> appear on any element
in a pipeline:</para>

<itemizedlist>
<listitem>
<para>The attribute <tag>xml:id</tag> with the semantics outlined in
<biblioref linkend="xml-id"/>.</para>
</listitem>
<listitem>
<para>The attribute <tag>xml:base</tag> with the semantics outlined in
<biblioref linkend="xml-base"/>.</para>
</listitem>
</itemizedlist>

<para>The following attributes <rfc2119>may</rfc2119> appear on any &stage;
element:</para>

<itemizedlist>
<listitem>
<para>The attribute <tag>p:ignore-prefixes</tag> with the semantics outlined
in <xref linkend="ignored-namespaces"/>.</para>
</listitem>
</itemizedlist>

</section>

<section xml:id="syntax-docs-ports">
<title>Associating Documents with Ports</title>

<para><termdef xml:id="dt-binding">A <firstterm>binding</firstterm> associates an input
or output port with some data source.</termdef>
A document or a sequence of documents can be bound to a port in
three ways: by source, by URI, or by providing it inline.
Each of these mechanisms is supported on the
<tag>p:input</tag>, <tag>p:output</tag>, <tag>p:xpath-context</tag>,
<tag>p:iteration-source</tag>, and <tag>p:viewport-source</tag>
elements.</para>

<variablelist>
<varlistentry>
<term>Specified by URI</term>
<listitem>
<para><termdef xml:id="dt-by-URI">A document is specified
<firstterm>by URI</firstterm> if it is referenced with a URI.</termdef>
The <tag class="attribute">href</tag>
attribute on the <tag>p:document</tag> element is used to refer
to documents by URI.</para>

<para>In this example, the input to the Identity &stage; named
“<literal>otherstep</literal>” comes from “<uri>http://example.com/input.xml</uri>”.
</para>

<programlisting>&lt;p:identity name="otherstep"&gt;
  &lt;p:input port="source"&gt;
    &lt;p:document href="http://example.com/input.xml"/&gt;
  &lt;/p:input&gt;
&lt;/p:identity&gt;

&lt;/p:pipeline&gt;
</programlisting>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm> if the processor
attempts to retrieve the URI specified on a <tag>p:document</tag>
and fails.</phrase> (For example, if the
resource does not exist or is not accessible with the user's
authentication credentials.)</para>
</listitem>
</varlistentry>

<varlistentry>
<term>Specified by source</term>
<listitem>
<para><termdef xml:id="dt-by-source">A document is specified
<firstterm>by source</firstterm> if it references a specific port
on another &stage;.</termdef> The 
<tag class="attribute">step</tag> and
<tag class="attribute">port</tag> attributes on the <tag>p:pipe</tag>
element are used for this purpose.
(The <tag class="attribute">step</tag> attribute may refer
to any kind of &stage;, either a &atom; <emphasis>or</emphasis>
a &construct;, its name notwithstanding.)</para>

<para>In this example, the “<literal>document</literal>” input to the XInclude &stage; named
“<literal>expand</literal>” comes from the “<literal>result</literal>”
port of the step named “<literal>otherstep</literal>”.</para>

<programlisting>&lt;p:xinclude name="expand"&gt;
  &lt;p:input port="source"&gt;
    &lt;p:pipe step="otherstep" port="result"/&gt;
  &lt;/p:input&gt;
&lt;/p:xinclude&gt;

&lt;/p:pipeline&gt;
</programlisting>

<para>When a pipe is used, the specified port must be
in the <glossterm>readable ports</glossterm> of the current environment.
<phrase role="err">It is a <glossterm>static error</glossterm> if the port specified by a
<tag>p:pipe</tag> is not in the <glossterm>readable ports</glossterm> of the
environment.</phrase></para>
</listitem>
</varlistentry>

<varlistentry>
<term>Specified inline</term>
<listitem>
<para><termdef xml:id="dt-inline-document">An
<firstterm>inline document</firstterm> is specified directly in
the body of the element that binds it.</termdef>
The content of the <tag>p:inline</tag> element is used for this purpose.
</para>

<para>In this example, the “<literal>stylesheet</literal>”
input to the XSLT &stage; named
“<literal>xform</literal>” comes from the content of the
<tag>p:input</tag> element itself.</para>

<programlisting>&lt;p:xslt name="xform"&gt;
  &lt;p:input port="source"&gt;
    &lt;p:pipe step="expand" port="result"/&gt;
  &lt;/p:input&gt;
  &lt;p:input port="stylesheet"&gt;
    &lt;p:inline&gt;
      &lt;xsl:stylesheet version="1.0"&gt;
        ...
      &lt;/xsl:stylesheet&gt;
    &lt;/p:inline&gt;
  &lt;/p:input&gt;
&lt;/p:xslt&gt;
</programlisting>

<para>Inline documents are considered “quoted”, they are not
interpolated or available to the pipeline processor in any way except
as documents flowing through the pipeline.</para>
</listitem>
</varlistentry>
</variablelist>

<para>Note that an <tag>p:input</tag> or <tag>p:output</tag> element
may contain more than one <tag>p:pipe</tag>, <tag>p:document</tag>,
or <tag>p:inline</tag>
element. If more than one <glossterm>binding</glossterm> is provided, then the 
specified sequence of documents is made available on that port.</para>
</section>

<section xml:id="ignored-namespaces">
<title>Ignored namespaces</title>

<para>The element children of a <glossterm>compound &stage;</glossterm>
fall into four classes: elements that provide bindings for input and output
ports, elements that provide bindings for options and parameters,
other elements that identify &stages; that
are part of its <glossterm>subpipeline</glossterm>, and extension elements.
Extension elements may be used for documentation or to provide additional
information for a specific processor.</para>

<para>To determine which elements are extension elements and which are expected
to identify &stages;, a set of ignored namespaces is maintained in the
<glossterm>environment</glossterm> of each &stage;.</para>

<para>The <glossterm>ignored
namespaces</glossterm> are a set of namespaces which do not identify
&stages;. They are ignored by the processor unless the processor happens
to recognize one or more of them as
<link linkend="extension-elements">extension elements</link>.
The initial set of ignored namespaces is empty.</para>

<para>Syntactically, a pipeline author can add namespaces to the set
of ignored namespaces with the
<tag class="attribute">p:ignore-prefixes</tag> attribute. This attribute
can appear on any element in the pipeline namespace which identifies a
&stage;.
<phrase role="err">It is a <glossterm>static error</glossterm> if the
<tag class="attribute">p:ignore-prefixes</tag>
attribute appears on any element which does not identify a &stage;.</phrase></para>

<para>The value of the <tag class="attribute">p:ignore-prefixes</tag> attribute
is a sequence of tokens, each of which must be the prefix of
an in-scope namespace.
<phrase role="err">It is a <glossterm>static error</glossterm> if any token
specified in the <tag class="attribute">p:ignore-prefixes</tag> attribute is not
the prefix of an in-scope namespace.</phrase></para>

<para>Each of the namespaces identified by the specified prefix is added to
the set of ignored namespaces in the environment of the &stage; on which
the attribute occurs.</para>
</section>

<section xml:id="documentation">
<title>Documentation</title>

<para>Pipeline authors may add documentation to their pipeline documents
with the <tag>p:doc</tag> element. Except when it appears as a descendant of
<tag>p:inline</tag>, the <tag>p:doc</tag> element is
completely ignored by pipeline processors, it exists simply for documentation
purposes. (If a <tag>p:doc</tag> is provided as a descendant of <tag>p:inline</tag>,
it has no special semantics, it is treated literally as part of the document
to be provided on that port.)</para>

<para>Pipeline processors that inspect the contents of <tag>p:doc</tag> elements
and behave differently on the basis of what they find are <emphasis>not
conformant</emphasis>. Processor extensions <rfc2119>must</rfc2119> be
specified with <link linkend="extension-elements">extension elements</link>.
</para>
</section>

<section xml:id="extension-attributes">
<title>Extension attributes</title>

<para><termdef xml:id="dt-extension-attribute">An element from the
XProc namespace <rfc2119>may</rfc2119> have any attribute not from the
XProc namespace, provided that the expanded-QName of the attribute has
a non-null namespace URI. Such an attribute is called an
<firstterm>extension attribute</firstterm>.</termdef> The presence of
an extension attribute must not cause the connections between &stages;
to differ from the connections that any other
conformant XProc processor would produce. They must not cause the
processor to fail to signal an error that a conformant processor is
required to signal. This means that an extension attribute must not
change the effect of any XProc element except to the extent that the
effect is implementation-defined or implementation-dependent.</para>

<para>A processor which encounters an extension attribute that it does not
recognize <rfc2119>must</rfc2119> behave as if the attribute was not present.</para>

</section>

<section xml:id="extension-elements">
<title>Extension elements</title>

<para>The presence of an extension element must not cause the
connections between &stages; to differ from the connections that any
other conformant XProc processor would produce. They must not cause
the processor to fail to signal an error that a conformant processor
is required to signal. This means that an extension element must not
change the effect of any XProc element except to the extent that the
effect is implementation-defined or implementation-dependent.</para>

<para>There are three contexts in which an extension element might
occur:</para>

<orderedlist>
<listitem>
<para>In an <glossterm>inline
document</glossterm>. All elements in an inline document are
considered quoted; no extension element can occur.
</para>
</listitem>
<listitem>
<para>In a <glossterm>subpipeline</glossterm>. In a subpipeline, any
element in a namespace that is in the set of ignored namespaces is an
extension element. Every other element identifies a &stage;.</para>
</listitem>
<listitem>
<para>In any other context, any element that is not in the pipeline
namespace is an extension element.</para>
</listitem>
</orderedlist>
</section>

<section xml:id="syntax-summaries">
<title>Syntax Summaries</title>

<para>The description of each element in the pipeline namespace is accompanied
by a syntactic summary that provides a quick overview of the element's
syntax:</para>

<e:element-syntax name="some-element" role="nosummary">
  <e:in-category name="language-example"/>
  <e:attribute name="some-attribute">
    <e:data-type name="some-type"/>
  </e:attribute>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:model name="some"/>
      <e:model name="elements"/>
      <e:model name="allowed"/>
    </e:choice>
    <e:model name="other-elements" repeat="zero-or-one"/>
  </e:sequence>
</e:element-syntax>

<para>For clarity of exposition, some attributes and elements are elided from
the summaries:</para>

<itemizedlist>
<listitem>
<para>An <tag class="attribute">xml:id</tag> attribute is allowed on any element.
It has the semantics of <biblioref linkend="xml-id"/>.</para>
</listitem>
<listitem>
<para>An <tag class="attribute">xml:base</tag> attribute is allowed on any element.
It has the semantics of <biblioref linkend="xml-base"/>.</para>
</listitem>
<listitem>
<para>The <tag>p:doc</tag> element is not shown, but it is allowed anywhere.</para>
</listitem>
</itemizedlist>
</section>
</section>

<section xml:id="components">
<title>&Stages;</title>

<para>This section describes the core &stages; of XProc.
</para>

<para>Every compound &stage; in a pipeline has six parts: a set of inputs, a
set of outputs, a set of options, a set of parameters, a set of <glossterm>contained
&stages;</glossterm>, and an environment.</para>

<note role="editorial" xml:id="allow-any-order">
<para>In previous drafts, inputs, outputs, options, and parameters occurred in
a fixed order. In this draft, they may appear in any order (but before the
contained steps). Is that an improvement?
</para>
</note>

<para>Except where otherwise noted, a compound &stage; can have an arbitrary
number of inputs, outputs, options, parameters, and contained &stages;.</para>

<section xml:id="p.pipeline">
<title>Pipeline</title>

<para>A Pipeline is specified by the <tag>p:pipeline</tag> element. It
encapsulates the behavior of a <glossterm>subpipeline</glossterm>. Its
children declare the inputs, outputs, and parameters that the pipeline
exposes and identify the &stages; in its subpipeline.
</para>

<para>A pipeline can declare additional &stages; (e.g., ones that are
provided by a particular implementation or in some
implementation-defined way) and import other pipelines.</para>

<e:element-syntax name="pipeline">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:element name="input"/>
      <e:element name="output"/>
      <e:element name="parameter"/>
      <e:element name="import" repeat="zero-or-more"/>
      <e:element name="declare-step" repeat="zero-or-more"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>Viewed from the outside, a [[pipeline]] is a
black box which performs some calculation on its inputs and produces
its outputs. From the pipeline author's perspective, the computation
performed by the pipeline is described in terms of <glossterm>contained
&stages;</glossterm> which read the pipeline's inputs and produce
the pipeline's outputs.</para>

<para>The <glossterm>environment</glossterm> of a [[pipeline]] is its
inherited environment with the
<link linkend="dt-standard-modifications">standard modifications</link>.
</para>

<para>The environment inherited by its
<glossterm>contained &stages;</glossterm>
is the <glossterm>empty environment</glossterm>
with these modifications:</para>

<itemizedlist>
<listitem>
<para>All of the declared inputs of the pipeline are added to the
<glossterm>readable ports</glossterm> in the environment.</para>
</listitem>
<listitem>
<para>If the pipeline has exactly one input, that input is
the <glossterm>default readable port</glossterm>, otherwise the default
readable port is undefined.</para>
</listitem>
<listitem>
<para>All of the <glossterm>declared parameters</glossterm> of the
pipeline are added to the
<glossterm>in-scope parameters</glossterm> in the environment.</para>
</listitem>
<listitem>
<para>If any ignored namespaces are specified, those
namespaces are added to the set of
<glossterm>ignored namespaces</glossterm> in the
environment.</para>
</listitem>
</itemizedlist>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the [[pipeline]],
then those outputs are bound to the <glossterm>default output port</glossterm> of
the <glossterm>last step</glossterm> in the <glossterm>subpipeline</glossterm>.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<para>There are two additional constraints on pipelines:</para>

<itemizedlist>
<listitem><para>A <tag>p:pipeline</tag> <rfc2119>must not</rfc2119> itself be
a <glossterm baseform="contained &stages;">contained &stage;</glossterm>.
</para></listitem>
<listitem><para>If a <tag>p:pipeline</tag> is part of a
<tag>p:pipeline-library</tag> or if it is imported directly with
<tag>p:import</tag>, then it <rfc2119>must</rfc2119> have a
name.</para>
</listitem>
</itemizedlist>

<section xml:id="example-pipeline" role="tocsuppress">
<title>Examples</title>

<para>A pipeline might accept a document and a stylesheet as input;
perform XInclude, validation, and transformation; and produce a
sequence of formatted documents as its output.</para>

<example xml:id="ex.p.pipeline">
<title>A Sample Pipeline Document</title>
<programlisting>&lt;p:pipeline name="pipeline" xmlns:p="http://www.w3.org/2007/03/xproc"&gt;
&lt;p:input port="document"/&gt;
&lt;p:input port="stylesheet"/&gt;
&lt;p:output port="result"/&gt;

&lt;p:xinclude&gt;
  &lt;p:input port="source"&gt;
    &lt;p:pipe step="pipeline" port="document"/&gt;
  &lt;/p:input&gt;
&lt;/p:xinclude&gt;

&lt;p:validate-xml-schema&gt;
  &lt;p:input port="schema"&gt;
    &lt;p:document href="http://example.com/path/to/schema.xsd"/&gt;
  &lt;/p:input&gt;
&lt;/p:validate-xml-schema&gt;

&lt;p:xslt&gt;
  &lt;p:input port="stylesheet"&gt;
    &lt;p:pipe step="pipeline" port="stylesheet"/&gt;
  &lt;/p:input&gt;
&lt;/p:xslt&gt;

&lt;/p:pipeline&gt;
</programlisting>
</example>
</section>
</section>

<section xml:id="p.for-each">
<title>For-Each</title>

<para>A For-Each is specified by the <tag>p:for-each</tag> element. It
processes a sequence of documents, applying its
<glossterm>subpipeline</glossterm> to each document in turn.</para>

<e:element-syntax name="for-each">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="select" required="no">
    <e:data-type name="xpath expression"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="iteration-source" repeat="zero-or-one"/>
    <e:choice repeat="zero-or-more">
      <e:element name="output"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>When a pipeline needs to process a sequence of documents using
a &stage; that only accepts a single document, the [[for-each]]
construct can be used as a wrapper around the &stage; that accepts
only a single document. The [[for-each]] will apply that &stage; to
each document in the sequence in turn.</para>

<para>The result of the [[for-each]] is a sequence of documents
produced by processing each individual document in the input sequence.
If the subpipeline is connected to one or more output ports on
the [[for-each]], what appears on each of those ports is the sequence
of documents produced by each iteration of the loop.</para>

<para>The <tag>p:iteration-source</tag> is an anonymous input:
its <glossterm>binding</glossterm>
provides a sequence of documents to the [[for-each]]
&construct;. If no iteration sequence is explicitly provided, then the
iteration source is read from the
<glossterm>default readable port</glossterm>.</para>

<para>A portion of each input document can be selected using the <tag class="attribute">select</tag> attribute. If no selection is
specified, the document node of each document is
selected.</para>

<para>Each subtree selected by the <tag>p:for-each</tag> from each
of the inputs that appear on the iteration source is wrapped in a document
node and provided to the <glossterm>subpipeline</glossterm>.
</para>

<para>The processor provides each document, one at a time, to the
<glossterm>subpipeline</glossterm> represented by the children of the
<tag>p:for-each</tag> on a port named
<code>current</code>.</para>

<para>For each declared output, the processor collects all the
documents that are produced for that output from all the iterations,
in order, into a sequence. The result of the <tag>p:for-each</tag> on
that output is that sequence of documents.</para>

<para>The <glossterm>environment</glossterm> of a [[for-each]] is its
inherited environment
with the <link linkend="dt-standard-modifications">standard modifications</link>.</para>

<para>The environment inherited by its <glossterm>contained &stages;</glossterm>
is the <link linkend="dt-standard-inheritance">standard inheritance</link>
with these modifications:</para>

<itemizedlist>
<listitem>
<para>The port named “<code>current</code>” on the <tag>p:for-each</tag> is
added to the <glossterm>readable ports</glossterm>.</para>
</listitem>
<listitem>
<para>The port named “<code>current</code>” on the <tag>p:for-each</tag> is
made the <glossterm>default readable port</glossterm>.</para>
</listitem>
</itemizedlist>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the [[for-each]],
then those outputs are bound to the <glossterm>default output port</glossterm> of
the <glossterm>last step</glossterm> in the <glossterm>subpipeline</glossterm>.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<section xml:id="example-for-each" role="tocsuppress">
<title>Examples</title>

<para>A [[for-each]] might accept a sequence of chapters as its input,
process each chapter in turn with XSLT, a &stage; that accepts only a
single input document, and produce a sequence of formatted chapters as
its output.</para>

<example xml:id="ex.p.for-each">
<title>A Sample For-Each</title>
<programlisting>&lt;p:for-each name="chapters" select="//chapter"&gt;
  &lt;p:output port="html-results"&gt;
    &lt;p:pipe step="make-html" port="result"/&gt;
  &lt;/p:output&gt;
  &lt;p:output port="fo-results"&gt;
    &lt;p:pipe step="make-fo" port="result"/&gt;
  &lt;/p:output&gt;

  &lt;p:xslt name="make-html"&gt;
    &lt;p:input port="stylesheet"&gt;
      &lt;p:document href="http://examplecom/xsl/html.xsl"/&gt;
    &lt;/p:input&gt;
  &lt;/p:xslt&gt;

  &lt;p:xslt name="make-fo"&gt;
    &lt;p:input port="stylesheet"&gt;
      &lt;p:document href="http://examplecom/xsl/fo.xsl"/&gt;
    &lt;/p:input&gt;
  &lt;/p:xslt&gt;
&lt;/p:for-each&gt;
</programlisting>
</example>

<para>The <code>//chapter</code> elements of the document are
selected. Each chapter is transformed into HTML and XSL Formatting Objects using an
XSLT &stage;. The resulting HTML and FO documents are aggregated together
and appear on the <literal>html-results</literal> and <literal>fo-results</literal>
ports, respectively, of the <literal>chapters</literal> &construct; itself.</para>
</section>
</section>

<section xml:id="p.viewport">
<title>Viewport</title>

<para>A Viewport is specified by the <tag>p:viewport</tag> element. It
processes a single document, applying its
<glossterm>subpipeline</glossterm> to one or more subsections of the
document.
</para>

<e:element-syntax name="viewport">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="match" required="yes">
    <e:data-type name="xpath expression"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="viewport-source" repeat="zero-or-one"/>
    <e:element name="output"/>
    <e:element name="parameter" repeat="zero-or-more"/>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>The result of the [[viewport]] is a copy of the original
document with the selected subsections replaced by the results of
applying the subpipeline to them.</para>

<para>The <tag>p:viewport-source</tag> is an anonymous input:
its <glossterm>binding</glossterm>
provides a single document to the [[viewport]]
&construct;. If no document is explicitly provided, then the
viewport source is read from the
<glossterm>default readable port</glossterm>.</para>

<para>The <tag class="attribute">match</tag> attribute specifies an
<biblioref linkend="xpath"/>
expression that is a
<link xlink:href="http://www.w3.org/TR/xslt#NT-Pattern">Pattern</link>
in <biblioref linkend="xslt10"/>. Each matching node in the source document
is wrapped in a document node and provided to the viewport's
<glossterm>subpipeline</glossterm>. After a node has been matched, its
descendants are not considered for further matching. In other words, a node
is passed at most once to the subpipeline.</para>

<para>The processor provides each document, one at a time, to the
<glossterm>subpipeline</glossterm> represented by the children of the
<tag>p:viewport</tag> on a port named
<code>current</code>.</para>

<para>What appears on the output from the <tag>p:viewport</tag> will
be a copy of the input document where each matching node is
replaced by the result of applying the subpipeline to the subtree
rooted at that node.</para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm>
if the viewport source is a sequence of more than one document or if
the output from any iteration is a sequence of more than one
document.</phrase></para>

<para>The <glossterm>environment</glossterm> of a [[viewport]] is its
inherited environment
with the <link linkend="dt-standard-modifications">standard modifications</link>.</para>

<para>The environment inherited by its <glossterm>contained &stages;</glossterm>
is the <link linkend="dt-standard-inheritance">standard inheritance</link>
with this modification:</para>

<itemizedlist>
<listitem>
<para>The port named “<code>current</code>” on the <tag>p:viewport</tag> is
added to the <glossterm>readable ports</glossterm>.</para>
</listitem>
<listitem>
<para>The port named “<code>current</code>” on the <tag>p:viewport</tag> is
made the <glossterm>default readable port</glossterm>.</para>
</listitem>
</itemizedlist>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the [[viewport]],
then those outputs are bound to the <glossterm>default output port</glossterm> of
the last step in the <glossterm>subpipeline</glossterm>.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<section xml:id="example-viewport" role="tocsuppress">
<title>Examples</title>

<para>A [[viewport]] might accept an XHTML document as its input,
add an <tag>hr</tag> element before all <tag>div</tag> elements that
have the class value “chapter”, 
and return an XHTML document that is the same as the original except
for that change.</para>

<example xml:id="ex.p.viewport">
<title>A Sample Viewport</title>
<programlisting>&lt;p:viewport match="h:div[@class='chapter']"&gt;
  &lt;p:output port="result"/&gt;
  &lt;p:insert&gt;
    &lt;p:input port="insertion"&gt;
      &lt;p:inline&gt;
	&lt;hr xmlns="http://www.w3.org/1999/xhtml"/&gt;
      &lt;/p:inline&gt;
    &lt;/p:input&gt;
    &lt;p:option name="at-start" value="true"/&gt;
  &lt;/p:insert&gt;
&lt;/p:viewport&gt;
</programlisting>
</example>

<para>The nodes which match <code>h:div[@class='chapter']</code> (according to the
rules of <biblioref linkend="xslt10"/>) in the input document are selected.
An <code>hr</code> is inserted as the first child of each <code>h:div</code>
and the resulting version replaces the original <code>h:div</code>.
The result of the whole &construct; is
a copy of the input document with a horizontal rule before each
selected <code>h:div</code>.</para>
</section>
</section>

<section xml:id="p.choose">
<title>Choose</title>

<para>A Choose is specified by the <tag>p:choose</tag> element. It
selects exactly one of a list of alternative
<glossterm baseform="subpipeline">subpipelines</glossterm> based on the
evaluation of <biblioref linkend="xpath"/> expressions.</para>

<e:element-syntax name="choose">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="xpath-context" repeat="zero-or-one"/>
    <e:element name="when" repeat="zero-or-more"/>
    <e:element name="otherwise" repeat="zero-or-one"/>
  </e:sequence>
</e:element-syntax>

<para>A [[choose]] has no inputs. It contains an arbitrary number of
alternative <glossterm baseform="subpipeline">subpipelines</glossterm>,
exactly one of which
will be evaluated.</para>

<para>The list of alternative subpipelines consists of zero or more
subpipelines, each guarded by an XPath expression (with an associated
context), followed optionally by a single default subpipeline.</para>

<para>The [[choose]] considers each subpipeline in turn and selects
the first (and only the first) subpipeline for which the guard
expression evaluates to true in its context.
If there are no subpipelines for which the expression evaluates to
true, the default subpipeline, if it was specified, is
selected.</para>

<para>After a <glossterm>subpipeline</glossterm> is selected, it is
evaluated as if only it had been present.</para>

<para>The result of the [[choose]]
is the result of the selected <glossterm>subpipeline</glossterm>.</para>

<para>In order to ensure that the result of the [[choose]] is
consistent irrespective of the <glossterm>subpipeline</glossterm> chosen,
each <glossterm>subpipeline</glossterm> must
declare the same number outputs with the same names.
<phrase role="err">It is a 
<glossterm>static error</glossterm> if two
<glossterm baseform="subpipeline">subpipelines</glossterm>
in a [[choose]] declare different outputs.</phrase></para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm>
if no <glossterm>subpipeline</glossterm> is selected by the [[choose]]
and no default is provided.</phrase></para>

<para>The <tag>p:choose</tag> can specify the context node against which
the
<biblioref linkend="xpath"/>
expressions that occur on each branch are evaluated. The context
node is specified as a
<glossterm>binding</glossterm> for the
<tag>xpath-context</tag>. If no binding is provided, the default
<tag>xpath-context</tag> is the document on the
<glossterm>default readable port</glossterm>.</para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm>
if the <tag>xpath-context</tag> is bound to a sequence of
documents.</phrase></para>

<para>The <glossterm>environment</glossterm> of a [[choose]] is its
inherited environment
with the <link linkend="dt-standard-modifications">standard modifications</link>.</para>

<para>Each conditional <glossterm>subpipeline</glossterm> is represented by a 
<tag xml:id="p.when">p:when</tag> element.</para>

<e:element-syntax name="when">
  <e:in-category name="language-construct"/>
  <e:attribute name="test" required="yes">
    <e:data-type name="expression"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="xpath-context" repeat="zero-or-one"/>
    <e:choice repeat="zero-or-more">
      <e:element name="output"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>Each <tag>p:when</tag> branch of the <tag>p:choose</tag> has a
<tag class="attribute">test</tag> attribute which <rfc2119>must</rfc2119>
contain an
<biblioref linkend="xpath"/>
expression. That XPath expression's effective boolean value is the
guard expression for the <glossterm>subpipeline</glossterm> contained
within that <tag>p:when</tag>.</para>

<para>The <tag>p:when</tag> can specify a context node against which
its <tag class="attribute">test</tag> expression is to be evaluated.
That context node is specified as a <glossterm>binding</glossterm>
for the <tag>xpath-context</tag>.
If no context is specified on the <tag>p:when</tag>, the context
of the <tag>p:choose</tag> is used. <phrase role="err">It is a
<glossterm>static error</glossterm> if no context is specified in
either the <tag>p:choose</tag> or the <tag>p:when</tag>
and the <glossterm>default readable port</glossterm> is
undefined.</phrase></para>

<para>The default branch is represented by a
<tag xml:id="p.otherwise">p:otherwise</tag> element.</para>

<e:element-syntax name="otherwise">
  <e:in-category name="language-construct"/>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:element name="output"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>The <glossterm>environment</glossterm> of the selected subpipeline is the
inherited environment
with the <link linkend="dt-standard-modifications">standard modifications</link>.</para>

<para>The environment inherited by its <glossterm>contained &stages;</glossterm>
is the <link linkend="dt-standard-inheritance">standard inheritance</link>.
</para>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the selected subpipeline,
then those outputs are bound to the <glossterm>default output port</glossterm> of
the last step in the selected subpipeline.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<section xml:id="example-choose" role="tocsuppress">
<title>Examples</title>

<para>A [[choose]] might test the version attribute of the document
element of a document and validate with an appropriate schema.</para>

<example xml:id="ex.p.choose">
<title>A Sample Choose</title>
<programlisting>&lt;p:choose name="version"&gt;
  &lt;p:when test="/*[@version = 2]"&gt;
    &lt;p:output port="result"/&gt;
    &lt;p:validate-xml-schema&gt;
      &lt;p:input port="schema"&gt;
	&lt;p:document href="v2schema.xsd"/&gt;
      &lt;/p:input&gt;
    &lt;/p:validate-xml-schema&gt;
  &lt;/p:when&gt;

  &lt;p:when test="/*[@version = 1]"&gt;
    &lt;p:output port="result"/&gt;
    &lt;p:validate-xml-schema&gt;
      &lt;p:input port="schema"&gt;
	&lt;p:document href="v1schema.xsd"/&gt;
      &lt;/p:input&gt;
    &lt;/p:validate-xml-schema&gt;
  &lt;/p:when&gt;

  &lt;p:otherwise&gt;
    &lt;p:output port="result"/&gt;
    &lt;p:identity/&gt;
  &lt;/p:otherwise&gt;
&lt;/p:choose&gt;
</programlisting>
</example>
</section>
</section>

<section xml:id="p.group">
<title>Group</title>

<para>A Group is specified by the <tag>p:group</tag> element. It
encapsulates the behavior of its <glossterm>subpipeline</glossterm>.</para>

<e:element-syntax name="group">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:element name="output"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>A [[group]] is a convenience wrapper for a collection of &stages;.
The result of a [[group]] is the result of its subpipeline.</para>

<para>The <glossterm>environment</glossterm> of a [[group]] is its
inherited environment with the <link linkend="dt-standard-modifications">standard
modifications</link>.</para>

<para>The environment inherited by its <glossterm>contained &stages;</glossterm>
is the <link linkend="dt-standard-inheritance">standard inheritance</link>.
</para>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the [[group]],
then those outputs are bound to the <glossterm>default output port</glossterm> of
the <glossterm>last step</glossterm> in the <glossterm>subpipeline</glossterm>.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<section xml:id="example-group" role="tocsuppress">
<title>Examples</title>

<para>This group simplifies specification of the “profile” parameter
to the XSLT step.</para>

<example xml:id="ex.p.group">
<title>An Example Group</title>
<programlisting>&lt;p:pipeline name="pipeline" xmlns:p="http://www.w3.org/2007/03/xproc"&gt;
&lt;p:input port="document"/&gt;
&lt;p:input port="config"/&gt;
&lt;p:output port="result"/&gt;

&lt;p:group&gt;
  &lt;p:parameter name="profile" select="/config/profile"&gt;
    &lt;p:pipe step="pipeline" port="config"/&gt;
  &lt;/p:parameter&gt;
  &lt;p:output port="result"/&gt;

  &lt;p:choose&gt;
    &lt;p:when test="/config/output = 'fo'"&gt;
      &lt;p:xpath-context&gt;
	&lt;p:pipe step="pipeline" port="config"/&gt;
      &lt;/p:xpath-context&gt;
      &lt;p:output port="result"/&gt;
      &lt;p:xslt&gt;
	&lt;p:input port="source"&gt;
	  &lt;p:pipe step="pipeline" port="document"/&gt;
	&lt;/p:input&gt;
	&lt;p:input port="stylesheet"&gt;
	  &lt;p:document href="http://example.com/style/fo.xsl"/&gt;
	&lt;/p:input&gt;
	&lt;p:parameter name="profile" select="$profile"/&gt;
      &lt;/p:xslt&gt;
    &lt;/p:when&gt;
    &lt;p:otherwise&gt;
      &lt;p:output port="result"/&gt;
      &lt;p:xslt&gt;
	&lt;p:input port="source"&gt;
	  &lt;p:pipe step="pipeline" port="document"/&gt;
	&lt;/p:input&gt;
	&lt;p:input port="stylesheet"&gt;
	  &lt;p:document href="http://example.com/style/xhtml.xsl"/&gt;
	&lt;/p:input&gt;
	&lt;p:parameter name="profile" select="$profile"/&gt;
      &lt;/p:xslt&gt;
    &lt;/p:otherwise&gt;
  &lt;/p:choose&gt;
&lt;/p:group&gt;

&lt;/p:pipeline&gt;
</programlisting>
</example>
</section>
</section>

<section xml:id="p.try">
<title>Try/Catch</title>

<para>A Try/Catch is specified by the <tag>p:try</tag> element. It
isolates a <glossterm>subpipeline</glossterm>, preventing any errors
that arise within it from being exposed to the rest of the
pipeline.</para>

<e:element-syntax name="try">
  <e:in-category name="language-construct"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="group"/>
    <e:element name="catch"/>
  </e:sequence>
</e:element-syntax>

<para>The <tag>p:group</tag> represents the initial subpipeline and
the recovery (or “catch”) pipeline is identified with a
<tag>p:catch</tag> element.</para>

<para>The [[try]] &construct;
evaluates the initial subpipeline and, if no errors occur, the results of that
pipeline are the results of the &construct;. However, if any errors
occur, it abandons the first subpipeline, discarding any output that
it might have generated, and evaluates the recovery subpipeline.</para>

<note role="editorial" xml:id="specify-errors">
<para>In the context of try/catch, “errors” refers to &stage; failure which
is not the same as a static or dynamic error in the pipeline itself. (Though perhaps
it will be possible to recover from some dynamic errors.) The notion of &stage;
failure as a distinct class of error needs to be described.</para>
</note>

<para>If the recovery subpipeline is evaluated, the results of the
recovery subpipeline are the results of the [[try]] &construct;. If
the recovery subpipeline is evaluated and a &stage; within that
subpipeline fails, the [[try]] fails.</para>

<para>In order to ensure that the result of the [[try]] is consistent
irrespective of whether the initial subpipeline provides its output or
the recovery subpipeline does, both subpipelines must declare the same
number of outputs with the same names.
<phrase role="err">It is a <glossterm>static
error</glossterm> if the <tag>p:group</tag> and <tag>p:catch</tag> subpipelines
declare different outputs.</phrase></para>

<para>The <glossterm>environment</glossterm> of a [[try]] is its
inherited environment with the <link linkend="dt-standard-modifications">standard
modifications</link>.</para>

<para>The environment inherited by its initial subpipeline, the
<tag>p:group</tag>, is the environment of the [[try]].</para>

<para>The recovery subpipeline of a [[try]]
is identified with a <tag xml:id="p.catch">p:catch</tag>:</para>

<e:element-syntax name="catch">
  <e:in-category name="language-construct"/>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:element name="output"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline"/>
  </e:sequence>
</e:element-syntax>

<para>The environment of a <tag>p:catch</tag> is the environment of
its containing <tag>p:try</tag>.</para>

<para>The environment inherited by the <glossterm>contained &stages;</glossterm>
of the <tag>p:catch</tag>
is the <link linkend="dt-standard-inheritance">standard inheritance</link>
with this modification:</para>

<itemizedlist>
<listitem>
<para>The port named “<code>error</code>” on the <tag>p:catch</tag> is
added to the <glossterm>readable ports</glossterm>.</para>
</listitem>
</itemizedlist>

<note role="editorial" xml:id="default-to-error">
<para>Should the error port be made the default readable port?</para>
</note>

<para>If there is no <glossterm>binding</glossterm> for
any of the <glossterm>declared outputs</glossterm> of the [[catch]],
then those outputs are bound to the <glossterm>default output port</glossterm> of
the last step in the <glossterm>subpipeline</glossterm>.
<phrase role="err">It is a <glossterm>static error</glossterm> if an output is bound to
the <glossterm>default output port</glossterm> and the default output port
is undefined.</phrase></para>

<section xml:id="example-try" role="tocsuppress">
<title>Examples</title>

<para>A pipeline might attempt to process a document by dispatching it
to some web service. If the web service succeeds, then those results
are passed to the rest of the pipeline. However, if the web service
cannot be contacted or reports an error, the [[catch]] &construct; can
provide some sort of default for the rest of the pipeline.</para>

<example xml:id="ex.p.trycatch">
<title>An Example Try/Catch</title>
<programlisting>&lt;p:try&gt;
  &lt;p:group&gt;
    &lt;p:output port="result"/&gt;
    &lt;p:http-request&gt;
      &lt;p:input port="source"&gt;
	&lt;p:inline&gt;
	  &lt;c:http-request method="post" href="http://example.com/form-action"&gt;
	    &lt;c:entity-body content-type="application/x-www-form-urlencoded"&gt;
	      &lt;c:body&gt;name=W3C&amp;amp;spec=XProc&lt;/c:body&gt;
	    &lt;/c:entity-body&gt;
	  &lt;/c:http-request&gt;
	&lt;/p:inline&gt;
      &lt;/p:input&gt;
    &lt;/p:http-request&gt;
  &lt;/p:group&gt;
  &lt;p:catch&gt;
    &lt;p:output port="result"/&gt;
    &lt;p:identity&gt;
      &lt;p:input port="source"&gt;
	&lt;p:inline&gt;
	  &lt;c:error&gt;HTTP Request Failed&lt;/c:error&gt;
	&lt;/p:inline&gt;
      &lt;/p:input&gt;
    &lt;/p:identity&gt;
  &lt;/p:catch&gt;
&lt;/p:try&gt;
</programlisting>
</example>

</section>
</section>

<section xml:id="p.other">
<title>Other &Stages;</title>

<para>Other steps are specified by elements that occur as
<glossterm>contained steps</glossterm> and are not in any of the the ignored
namespaces.</para>

<e:element-syntax name="other-step" role="nosummary">
  <e:in-category name="other-step"/>
  <e:attribute name="name">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:choice repeat="zero-or-more">
      <e:element name="input"/>
      <e:element name="output"/>
      <e:element name="option"/>
      <e:element name="import-parameter"/>
      <e:element name="parameter"/>
    </e:choice>
    <e:model name="subpipeline" repeat="zero-or-one"/>
  </e:sequence>
</e:element-syntax>

<para>Each of these steps must have been declared with
<tag>p:declare-step</tag> or it must be the name of an imported
<tag>p:pipeline</tag> (or a <tag>p:pipeline</tag> in the same library).</para>

<para><phrase role="err">It is a <glossterm>static error</glossterm> if a pipeline
contains a &stage; that is not declared or imported or if the specified
inputs, outputs, and parameters do not
<glossterm baseform="matches">match</glossterm> the
<glossterm>signature</glossterm> for &stages; of that type.</phrase></para> 

<para>The <glossterm>environment</glossterm> of such a step is its
inherited environment with the <link linkend="dt-standard-modifications">standard
modifications</link>.</para>

<para>If the step element is the same as the type of a step
declared with <tag>p:declare-step</tag>, then that step invokes
the declared step.</para>

<para>If the step element is the name of a <tag>p:pipeline</tag>,
then that step runs the named pipeline.</para>

</section>
</section>

<section xml:id="other-elements">
<title>Other pipeline elements</title>

<section xml:id="p.input">
<title>p:input Element</title>

<para>A <tag>p:input</tag> identifies input for a &stage;, optionally
declaring it, if necessary.</para>

<e:element-syntax name="input">
  <e:in-category name="language-construct"/>
  <e:attribute name="port" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="sequence">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The <tag class="attribute">port</tag> attribute defines the name
of the port. <phrase role="err">It is a <glossterm>static error</glossterm> to identify
two ports with the same name on the same &stage;.</phrase>
<phrase role="err">It is a <glossterm>static error</glossterm>
if the <tag class="attribute">port</tag> given does not match the name
of an input port specified in the &stage;'s declaration.</phrase></para>

<para>On compound &constructs; and <tag>p:declare-step</tag>, an input
declaration can indicate if a sequence of documents is allowed to
appear on the port. If <tag class="attribute">sequence</tag>
is specified with the value “yes”, then a sequence is allowed.
<phrase role="err">If
<tag class="attribute">sequence</tag> is not specified on
<tag>p:input</tag>, or has the value “no”, then it is a
<glossterm>dynamic error</glossterm> for a sequence of more than one
document to appear on the declared port.</phrase></para>

<para>The declaration <rfc2119>may</rfc2119> be accompanied by a
<glossterm>binding</glossterm>
for the input:</para>

<e:element-syntax name="input">
  <e:in-category name="language-construct"/>
  <e:attribute name="port" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="sequence">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:attribute name="select">
    <e:data-type name="xpath expression"/>
  </e:attribute>
  <e:choice repeat="zero-or-more">
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

<para>If a binding is provided, a <tag class="attribute">select</tag>
expression <rfc2119>may</rfc2119> also be provided. The <tag class="attribute">select</tag> expression, if specified, applies the
specified
<biblioref linkend="xpath"/>
select expression to the document(s) that are read.
Each node that matches is wrapped in a document and provided to the
input port. After a node has been matched, its descendants are not
considered for further matching; a node is passed at
most once as input. In other words,</para>

<programlisting>&lt;p:input port="source"&gt;
  &lt;p:document href="http://example.org/input.html"/&gt;
&lt;/p:input&gt;
</programlisting>

<para>provides a single document, but</para>

<programlisting>&lt;p:input port="source" select="//html:div"&gt;
  &lt;p:document href="http://example.org/input.html"/&gt;
&lt;/p:input&gt;
</programlisting>

<para>provides a sequence of zero or more documents, one for each matching
<code>html:div</code> (that is not itself a descendant of an
<code>html:div</code>) in <uri>http://example.org/input.html</uri>.</para>

<para>A select expression can equally be applied to input read from
another &stage;. This input:</para>

<programlisting>&lt;p:input port="source" select="//html:div"&gt;
  &lt;p:pipe step="origin" port="result"/&gt;
&lt;/p:input&gt;
</programlisting>

<para>provides a sequence of zero or more documents, one for each matching
<code>html:div</code> in the document (or each of the documents)
that is read from the <literal>portname</literal>
port of the &stage; named <literal>origin</literal>.</para>

<para>In contexts where a binding is required, an empty <tag>p:input</tag>
is bound to an empty sequence of documents.</para>

</section>

<section xml:id="p.iteration-source">
<title>p:iteration-source Element</title>

<para>A <code>p:iteration-source</code> identifies input to a [[for-each]].</para>

<e:element-syntax name="iteration-source">
  <e:attribute name="select">
    <e:data-type name="xpath expression"/>
  </e:attribute>
  <e:choice repeat="zero-or-more">
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

<para>The <tag class="attribute">select</tag> attribute and
<glossterm>binding</glossterm> elements
of a <tag>p:iteration-source</tag> work the same way that they do in a
<tag>p:input</tag>.</para>
</section>

<section xml:id="p.viewport-source">
<title>p:viewport-source Element</title>

<para>A <code>p:viewport-source</code> identifies input to a [[viewport]].</para>

<e:element-syntax name="viewport-source">
  <e:choice>
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

<para>Exactly one <glossterm>binding</glossterm> element
is allowed and it works the same way that binding elements work in a
<tag>p:input</tag>. No <tag class="attribute">select</tag> expression is allowed.</para>
</section>

<section xml:id="p.xpath-context">
<title>p:xpath-context Element</title>

<para>A <code>p:xpath-context</code> identifies a context against which
an
<biblioref linkend="xpath"/>
expression will be evaluated for a <tag>p:when</tag>.
</para>

<e:element-syntax name="xpath-context">
  <e:choice>
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

<para>Exactly one <glossterm>binding</glossterm> element
is allowed and it works the same way that binding elements work in a
<tag>p:input</tag>. No <tag class="attribute">select</tag> expression is allowed.</para>
</section>

<!-- ============================================================ -->

<section xml:id="p.output">
<title>p:output Element</title>

<para>A <tag>p:output</tag> identifies an output port, optionally
declaring it, if necessary.</para>

<e:element-syntax name="output">
  <e:in-category name="language-construct"/>
  <e:attribute name="port" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="sequence">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:attribute name="default">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The <tag class="attribute">port</tag> attribute defines the name
of the port. <phrase role="err">It is a <glossterm>static error</glossterm> to identify
two ports with the same name on the same &stage;.</phrase>
<phrase role="err">It is a <glossterm>static error</glossterm>
if the <tag class="attribute">port</tag> given does not match the name
of an output port specified in the &stage;'s declaration.</phrase></para>

<para>An output declaration can indicate if a sequence of documents is
allowed to appear on the declared port. If
<tag class="attribute">sequence</tag> is specified with the value “yes”,
then a sequence is allowed.
<phrase role="err">If <tag class="attribute">sequence</tag> is not
specified on <tag>p:output</tag>, or has the value “no”, then it is a
<glossterm>dynamic error</glossterm> if the &stage; produces a
sequence of more than one document on the declared port.</phrase></para>

<para>An output declaration can indicate if it is to be considered the
default output for the &stage;.
If <tag class="attribute">default</tag> is specified with the value “yes”,
then the named port will be treated as the default output port.
<phrase role="err">It is a <glossterm>static error</glossterm> to identify
two different output ports as the default.</phrase></para>

<para><phrase role="err">It is a <glossterm>static error</glossterm> to specify
<literal>default="no"</literal> on the <tag>p:output</tag> of a step which has exactly one
output.</phrase> In other words, if any step or &stage; has exactly one output,
that output is always the default output.</para>

<para>The declaration <rfc2119>may</rfc2119> be accompanied by a
<glossterm>binding</glossterm> for the output.</para>

<e:element-syntax name="output">
  <e:in-category name="language-construct"/>
  <e:attribute name="port" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="sequence">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:attribute name="default">
    <e:data-type name="yes|no"/>
  </e:attribute>
  <e:choice repeat="zero-or-more">
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

</section>

<!-- ============================================================ -->

<section xml:id="p.option">
<title>p:option Element</title>

<para>The <tag>p:option</tag> element is used both to declare
options and to establish values for them. When used on a
<tag>p:declare-&stage;</tag> or compound &construct;,
<tag>p:option</tag> declares the option and may associate a
default value with it. Used elsewhere, <tag>p:option</tag>
associates a value with the option.</para>

<para>Options are
<link linkend="parameter-declaration">declared</link>,
<link linkend="parameter-use">used</link>, and have
<link linkend="parameter-values">values assigned</link> in a manner
exactly analogous to the <tag>p:parameter</tag> element.</para>
</section>

<!-- ============================================================ -->

<section xml:id="p.parameter">
<title>p:parameter Element</title>

<para>The <tag>p:parameter</tag> element is used both to declare
parameters and to establish values for them. When used on a
<tag>p:declare-&stage;</tag> or compound &construct;,
<tag>p:parameter</tag> declares the parameter and may associate a
default value with it. Used elsewhere, <tag>p:parameter</tag>
associates a value with the parameter.</para>

<section xml:id="parameter-declaration">
<title>Declaring Parameters</title>

<para>Parameters are declared on <tag>p:declare-&stage;</tag> and
compound &constructs; with <tag>p:parameter</tag>:</para>

<e:element-syntax name="parameter">
  <e:in-category name="language-construct"/>
  <e:attribute name="name" required="yes">
    <e:data-type name="token"/>
  </e:attribute>
  <e:attribute name="required">
    <e:data-type name="yes | no"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The <tag class="attribute">name</tag> attribute must be a
QName, a single asterisk (<literal>*</literal>), or a string of the form
<literal>*:<replaceable>NCName</replaceable></literal> or
<literal><replaceable>NCName</replaceable>:*</literal>.</para>

<para>If the <tag class="attribute">name</tag> is a QName, the parameter
may be declared as <tag class="attribute">required</tag> or it may
be
<link linkend="parameter-values">given a default value</link>.
<phrase role="err">It is a <glossterm>static error</glossterm> to specify
that the parameter is <tag class="attribute">required</tag> or that it has
a default value if the <tag class="attribute">name</tag> given is not
a QName.</phrase>
<phrase role="err">It is a <glossterm>static error</glossterm> to specify
that the parameter is both <tag class="attribute">required</tag>
<emphasis>and</emphasis> has a default value.</phrase></para>

<para><phrase role="err">If a parameter is required, it is a <glossterm>static
error</glossterm> to invoke the &stage; without specifying a value for
that parameter.</phrase></para>
</section>

<section xml:id="parameter-use">
<title>Using Parameters</title>

<para>Parameters are used on &stage; with
<tag>p:parameter</tag>:</para>

<e:element-syntax name="parameter">
  <e:in-category name="language-construct"/>
  <e:attribute name="name" required="yes">
    <e:data-type name="token"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The parameter <rfc2119>must</rfc2119> be
<link linkend="parameter-values">given a value</link> when it is used.
</para>
</section>

<section xml:id="parameter-values">
<title>Assigning Values to Parameters</title>

<para>When a parameter is declared, it <rfc2119>may</rfc2119> be given
a default value. When it is used, it <rfc2119>must</rfc2119> be given
a value.</para>

<para>The value can be specified in two ways: with a
<tag class="attribute">select</tag> or 
<tag class="attribute">value</tag> attribute.</para>

<para>If a <tag class="attribute">select</tag> expression is given, it
is evaluated against the document specified
in the
<glossterm>binding</glossterm>
and the <biblioref linkend="xpath"/>
<emphasis>string value</emphasis> of the expression becomes the
value of the parameter. If no <tag class="attribute">select</tag>
expression is given, the XPath <emphasis>string value</emphasis>
of the document specified in the 
<glossterm>binding</glossterm>
becomes the default
value of the parameter.<phrase role="err">It is a <glossterm>dynamic error</glossterm>
if a document sequence is specified in the binding for a
<tag>p:parameter</tag>.</phrase></para>

<e:element-syntax name="parameter">
  <e:in-category name="language-construct"/>
  <e:attribute name="name" required="yes">
    <e:data-type name="QName"/>
  </e:attribute>
  <e:attribute name="select">
    <e:data-type name="XPath expression"/>
  </e:attribute>
  <e:choice>
    <e:element name="pipe"/>
    <e:element name="document"/>
    <e:element name="inline"/>
  </e:choice>
</e:element-syntax>

<para>The <tag class="attribute">select</tag> expression may refer to
the values of other in-scope parameters by variable reference.
<phrase role="err">It is a
<glossterm>static error</glossterm> if the variable reference uses a
QName that is not the name of an in-scope parameter or if the
reference is circular, either directly or indirectly.</phrase></para>

<para>If a <tag class="attribute">value</tag> attribute is specified,
its content becomes the value of the parameter.</para>

<e:element-syntax name="parameter">
  <e:in-category name="language-construct"/>
  <e:attribute name="name" required="yes">
    <e:data-type name="QName"/>
  </e:attribute>
  <e:attribute name="value" required="yes">
    <e:data-type name="string"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

</section>
</section>

<!-- ============================================================ -->

<section xml:id="p.import-parameter">
<title>p:import-parameter Element</title>

<para>An <tag>p:import-parameter</tag> provides a set of in-scope parameters
to a &stage;.</para>

<e:element-syntax name="import-parameter">
  <e:in-category name="language-construct"/>
  <e:attribute name="name" required="yes">
    <e:data-type name="token"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>All in-scope parameters which match the <tag class="attribute">name</tag>
are made available to the &stage; as if they had been specified with
individual <tag>p:parameter</tag> elements.</para>

<para>The <tag class="attribute">name</tag> attribute must be a single
asterisk (<literal>*</literal>), a QName, or a string of the form
<literal>*:<replaceable>NCName</replaceable></literal> or
<literal><replaceable>NCName</replaceable>:*</literal>.</para>
</section>

<!-- ============================================================ -->

<section xml:id="p.declare-step">
<title>p:declare-step Element</title>

<para>A <tag>p:declare-step</tag> provides the type and
<glossterm>signature</glossterm> of an implementation-dependent type
of &stage;. It declares the inputs, outputs, options, and parameters for all
&stages; of that type.</para>

<e:element-syntax name="declare-step">
  <e:in-category name="language-construct"/>
  <e:attribute name="&kind;" required="yes">
    <e:data-type name="QName"/>
  </e:attribute>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:sequence>
    <e:element name="input" repeat="zero-or-more"/>
    <e:element name="output" repeat="zero-or-more"/>
    <e:element name="option" repeat="zero-or-more"/>
    <e:element name="parameter" repeat="zero-or-more"/>
  </e:sequence>
</e:element-syntax>

<note role="editorial" xml:id="external-binding">
<para>We need to make some provision for identifying the
implementation of a declared step, even if it's no more than
implementation-defined extension attributes. We'll need some sort of
mechanism for declaring multiple implementations too.</para>
</note>

<para><phrase role="err">It is a <glossterm>static error</glossterm>
to identify an unrecognized &stage; in a
<glossterm>subpipeline</glossterm>.</phrase> It is not an error to
declare such a &stage;, only to use it.</para>

<para>Exactly one input declaration of a
<tag>p:declare-step</tag> <rfc2119>may</rfc2119> use the
<tag class="attribute">name</tag> “<literal>*</literal>” to indicate
that the &stage; accepts an arbitrary number of inputs.
</para>

<para>Exactly one output declaration of a
<tag>p:declare-step</tag> <rfc2119>may</rfc2119> use the
<tag class="attribute">name</tag> “<literal>*</literal>” to indicate
that the &stage; can produce an arbitrary number of outputs.
</para>

</section>

<!-- ============================================================ -->

<section xml:id="p.pipeline-library">
<title>p:pipeline-library Element</title>

<para>A <tag>p:pipeline-library</tag> is a collection of &stage;
declarations and/or pipeline definitions.
</para>

<e:element-syntax name="pipeline-library">
  <e:in-category name="language-construct"/>
  <e:attribute name="p:ignore-prefixes">
    <e:data-type name="prefix list"/>
  </e:attribute>
  <e:attribute name="namespace">
    <e:data-type name="URI"/>
  </e:attribute>
  <e:sequence>
    <e:element name="import" repeat="zero-or-more"/>
    <e:element name="declare-step" repeat="zero-or-more"/>
    <e:element name="pipeline" repeat="zero-or-more"/>
  </e:sequence>
</e:element-syntax>

<para>Libraries can import pipelines and/or other libraries. <phrase role="err">It is a <glossterm>static error</glossterm> if the import
references in a pipeline or pipeline library are
circular.</phrase></para>

<para>If the <tag>p:pipeline-library</tag> specifies a namespace with the
<tag class="attribute">namespace</tag> attribute, then all of the pipelines
that occur in the library are in that namespace.</para>

<para>For example, given the following pipeline library:</para>

<programlisting>&lt;p:pipeline-library xmlns:p="http://www.w3.org/2007/03/xproc"
		    namespace="http://example.com/ns/pipelines"&gt;

&lt;p:import href="ancillary-library.xml"/&gt;
&lt;p:import href="other-pipeline.xml"/&gt;

&lt;p:pipeline name="validate"&gt;
  …
&lt;/p:pipeline&gt;

&lt;p:pipeline name="format"&gt;
  …
&lt;/p:pipeline&gt;

&lt;/p:pipeline-library&gt;
</programlisting>

<para>The pipelines named “<literal>validate</literal>” and
“<literal>format</literal>” are in the namespace
<uri type="xmlnamespace">http://example.com/ns/pipelines</uri>. That means
that those pipelines must be invoked from the importing pipeline with
qualified names:</para>

<programlisting><![CDATA[<ex:validate>
  …
</ex:validate>]]></programlisting>

<para>(Assuming that the “<literal>ex</literal>” prefix is bound to
<uri>http://example.com/ns/pipelines</uri>.)</para>

<para>The pipeline library namespace applies only to pipelines that are
defined directly in the library; it does not apply to pipeline libraries
that are imported or pipelines that are directly imported.</para>

</section>

<!-- ============================================================ -->

<section xml:id="p.import">
<title>p:import Element</title>

<para>An <tag>p:import</tag> loads a pipeline or pipeline library, making
it available in the current environment.</para>

<e:element-syntax name="import">
  <e:in-category name="language-construct"/>
  <e:attribute name="href" required="yes">
    <e:data-type name="URI"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>An import statement loads the specified URI and makes any
pipelines declared within it available to the current pipeline.
An imported pipeline has an implicit signature that consists of the
inputs, outputs, options, and parameters declared on it.
</para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm> if the URI 
of a <tag>p:import</tag> cannot
be retrieved or if, once retrieved, it does not point to a
<tag>p:pipeline-library</tag> or <tag>p:pipeline</tag>.</phrase>
<phrase role="err">It is a <glossterm>dynamic error</glossterm> to import
a single pipeline if that pipeline does not have a
<tag class="attribute">name</tag>.</phrase></para>
</section>

<section xml:id="p.pipe">
<title>p:pipe Element</title>

<para>A <tag>p:pipe</tag> reads from the output port of another &stage;.</para>

<e:element-syntax name="pipe">
  <e:in-category name="language-construct"/>
  <e:attribute name="step" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:attribute name="port" required="yes">
    <e:data-type name="NCName"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The <tag>p:pipe</tag> element connects to the output port of another step.
It identifies the output port two which it connects with the name of the &stage; in the
<tag class="attribute">step</tag> attribute and the name of the port
on that &stage; in the <tag class="attribute">port</tag> attribute.</para>

<para><phrase role="err">In all cases except the <tag>p:output</tag>
of a <glossterm>compound step</glossterm>, it is a <glossterm>static
error</glossterm> if the port identified by a <tag>p:pipe</tag> is not
in the <glossterm>readable ports</glossterm> of the
<glossterm>environment</glossterm> of the step that contains the
<tag>p:pipe</tag>.</phrase></para>

<para><phrase role="err">It is a <glossterm>static error</glossterm>
if the port identified by a <tag>p:pipe</tag> in the
<tag>p:output</tag> of a compound step is not
in the <glossterm>readable ports</glossterm> of the environment
inherited by the <glossterm>contained steps</glossterm> of the
compound step.</phrase></para>

<para>In other words, the output of a compound step must be bound to
the output of one of its <glossterm>contained steps</glossterm>. All
other bindings must be to ports that are already readable in the
current environment.</para>

</section>

<section xml:id="p.inline">
<title>p:inline Element</title>

<para>A <tag>p:inline</tag> provides a document or a sequence of documents inline.</para>

<e:element-syntax name="inline">
  <e:in-category name="language-construct"/>
  <e:model name="anyElement"/>
</e:element-syntax>

<para>The content of the <tag>p:inline</tag> element is wrapped in a document
node and passed as input. The base URI of the document is the base URI of the
<tag>p:inline</tag> element.</para>

<note>
<para>The nodes inside a <tag>p:inline</tag> element naturally inherit
the namespaces that are in-scope at the point where they occur in the
pipeline document. Implementations must assure that those namespaces
remain in-scope in the resulting document.</para>
</note>

<para><phrase role="err">It is a <glossterm>static error</glossterm>
if the content of the <tag>p:inline</tag> element is not a well-formed
XML document.</phrase></para>

</section>

<section xml:id="p.document">
<title>p:document Element</title>

<para>A <tag>p:document</tag> reads an XML document from a URI.</para>

<e:element-syntax name="document">
  <e:in-category name="language-construct"/>
  <e:attribute name="href" required="yes">
    <e:data-type name="URI"/>
  </e:attribute>
  <e:empty/>
</e:element-syntax>

<para>The document identified by the URI in the <tag class="attribute">href</tag>
attribute is loaded and returned.</para>

<para><phrase role="err">It is a <glossterm>dynamic error</glossterm> if the document
referenced by a <tag>p:document</tag> element
does not exist, cannot be accessed, or is not a well-formed XML
document.</phrase></para>

<para>The parser which the <tag>p:document</tag> element employs
<rfc2119>must</rfc2119> be
conformant <citetitle>Namespaces in XML</citetitle>.
It <rfc2119>must not</rfc2119> perform validation.
It <rfc2119>must not</rfc2119> perform any other processing, such as
expanding XIncludes.</para>

<para>Use the load &stage; if you need to perform DTD-based
validation or if you wish to load documents that are not namespace
well-formed.</para>
</section>

<section xml:id="p.doc">
<title>p:doc Element</title>

<para>A <tag>p:doc</tag> contains human-readable documentation.</para>

<e:element-syntax name="doc">
  <e:in-category name="language-construct"/>
  <e:model name="any-well-formed-content"/>
</e:element-syntax>

<para>There are no constraints on the content of the <tag>p:doc</tag> element.
Documentation is ignored by pipeline processors.
</para>
</section>
</section>

<section xml:id="errors">
<title>Errors</title>

<para>Errors in a pipeline can be divided into two classes: static
errors and dynamic errors.</para>

<section xml:id="static-errors">
<title>Static Errors</title>

<para><termdef xml:id="dt-static-error">A <firstterm>static
error</firstterm> is one which can be detected before pipeline evaluation
is even attempted.</termdef> Examples of static errors include cycles,
incorrect specification of inputs and outputs, and reference to unknown
&stages;.</para>

<para>Static errors are fatal and must be detected before any &stages;
are evaluated.</para>

<?static-error-list?>

</section>

<section xml:id="dynamic-errors">
<title>Dynamic Errors</title>

<para>A <termdef xml:id="dt-dynamic-error">A <firstterm>dynamic
error</firstterm> is one which occurs while a pipeline is being
evaluated.</termdef> Examples of dynamic errors include references
to URIs that cannot be resolved, &stages; which fail, and pipelines
that exhaust the capacity of an implementation (such as memory or
disk space).</para>

<para>If a &stage; fails due to a dynamic error, failure propagates
upwards until either a [[try]] is encountered or the entire pipeline
fails. In other words, outside of a [[try]], &stage; failure causes
the entire pipeline to fail.</para>

<?dynamic-error-list?>

</section>
</section>

<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:p="http://www.w3.org/2007/03/xproc" xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" version="5.0-extension w3c-xproc" xml:id="std-components">

<title>Standard Step Library</title>

<para>This appendix describes the standard XProc components.</para>

<para>Some components in this appendix consume or produce an XML
vocabulary defined in this section.  In all cases, the namespace
for that vocabulary is <uri type="xmlnamespace">http://www.w3.org/2007/03/xproc-component</uri> and
is represented by the prefix 'c:' in this appendix.</para>

<note>
<para>The components described in this draft are intended mainly as a
starting point for discussion and to present a flavor for the sorts of
components envisioned. The WG has not yet discussed them in detail.</para>
</note>

<section xml:id="std-required">
<title>Required Components</title>

<para>This section describes standard components that must be supported
by any conforming processor.</para>

<!-- ************************************************************************-->

<section xml:id="c.identity">
<title>Identity</title>

<para>The identity &component; makes a verbatim copy of its input
available on its output.</para>

<p:declare-step type="p:identity">
  <p:input port="source" sequence="yes"/>   
  <p:output port="result" sequence="yes"/>   
</p:declare-step>
</section>

<!-- ************************************************************************-->

<section xml:id="c.join-sequences">
<title>Join Sequences</title>

<para>The Join Sequences &component; accepts an arbitrary number of input documents via an arbitrary number of input ports and aggregates them into one sequence of documents.</para>

<p:declare-step type="p:join-sequences">
  <p:input port="*" sequence="yes"/>   
  <p:output port="result" sequence="yes"/>   
</p:declare-step>

</section>

<!-- ************************************************************************-->

<section xml:id="c.load">
<title>Load</title>

<para>The load &component; has no inputs but takes a parameter that
specifies a URI of an XML resource that should be loaded and provided as
the result.</para>

<p:declare-step type="p:load">
  <p:output port="result"/>  
  <p:option name="href" required="yes"/>  
</p:declare-step>

<para>Load attempts to read an XML document from the specified URI. If the
document does not exist, or is not well-formed, the &component; fails. Otherwise,
the document read is produced on the <literal>result</literal> port.</para>

</section>

<!-- ************************************************************************-->

<section xml:id="c.store">
<title>Store</title>

<para>The store &component; stores a serialized version of its input
to a URI. The URI is either specified explicitly by the 'href' parameter
or implicitly by the base URI of the document. This &component; outputs
a reference to the location of the stored document.</para>

<note>
<para>Should this &component; allow sequences on its input?</para>
</note>

<p:declare-step type="p:store">
   <p:input port="source"/>  
   <p:output port="result"/>  
   <p:option name="href" required="no"/>  
   <p:option name="encoding" required="no" value="UTF-8"/>
</p:declare-step>
<para>The &component; attempts to store the XML document to the specified URI. If that URI scheme is not supported or such storage is not allowed,
the &component; fails.</para>

<para>The output of this component is a document containing a single
element of the form:</para>
<programlisting><![CDATA[<c:result href = anyURI />]]></programlisting>


<note>
<para>A more direct “serialize-to-octet-stream” component may also be required.
One, for example, that supports the XSLT 2.0/XQuery 1.0 Serialization
specification.</para>
</note>
</section>

<!-- ************************************************************************-->

<section xml:id="c.subsequence">
<title>Subsequence</title>

<para>The Subsequence &component; accepts a sequence of documents and produces a subsequence of that input.  It applies an XPath expression to each document in the sequence to determine whether the document is in the output.  If the expression evaluates to true, the document is copied to the output sequence.</para>

<p:declare-step type="p:subsequence">
  <p:input port="source" sequence="yes"/>   
  <p:output port="result" sequence="yes"/>   
  <p:option name="test" required="yes"/>  
</p:declare-step>

</section>

<!-- ************************************************************************-->

<section xml:id="c.xinclude">
<title>XInclude</title>

<para>The XInclude &component; applies xinclude processing semantics
to the document. The referenced documents are calculated against the
base URI and are not provided as input to the &component;.</para>

<p:declare-step type="p:xinclude">
  <p:input port="source" sequence="no"/>   
  <p:output port="result" sequence="no"/>   
</p:declare-step>
</section>

<!-- ************************************************************************-->

<section xml:id="c.xslt">
<title>XSLT</title>

<para>The xslt &component; applies an XSLT 1.0 transformation to a document.  The transformation is supplied by a single document on the
input port named 'transform'.  That transformation is applied to the
primary source document supplied on the input port named 'source'.
The result of the transformation is a sequence of documents on its 'result' port.</para>

<p:declare-step type="p:xslt">
  <p:input port="source" sequence="no"/>   
  <p:input port="transform" sequence="no"/>   
  <p:output port="result" sequence="yes"/>   
  <p:parameter name="*"/>
</p:declare-step>

<para>All of the specified parameters are made available to the
XSLT processor. If the XSLT processor signals a fatal error, the &component; fails,
otherwise the result of the transformation is produced on the
<literal>result</literal> port.</para>

<para>It should be noted that an XSLT 1.0 processor without any extensions can only produce a single
XML document as its result. However, many XSLT 1.0 processors provide extensions
which allow the processor to produce more than one result. In such cases, more than
one document may appear in the <literal>result</literal> port. The principle result
document will always appear <emphasis>last</emphasis>.</para>
</section>

<!-- ************************************************************************-->

<section xml:id="c.serialize">
<title>Serialize</title>

<para>The serialize &component; applies XML serialization to the
children of the document element and replaces those children with their
serialization. The outcome is a single element with text content that
represents the "escaped" syntax of the children if they were
serialized.</para>

<p:declare-step type="p:serialize">
  <p:input port="source" sequence="no"/>   
  <p:output port="result" sequence="no"/>   
</p:declare-step>

<para>For example, the input:</para>
<programlisting>&lt;description&gt;
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;This is a chunk of XHTML.&lt;/p&gt;
&lt;/div&gt;
&lt;/description&gt;
</programlisting>
<para>and produces:</para>
<programlisting>&lt;description&gt;
&amp;lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&amp;lt;p&gt;This is a chunk of XHTML.&amp;lt;/p&gt;
&amp;lt;/div&gt;
&lt;/description&gt;
</programlisting>

</section>

<!-- ************************************************************************-->

<section xml:id="c.parse">
<title>Parse</title>

<para>The parse &component; takes the text value of the document
element and parses the content as if it was and unicode character stream
containing XML. The outcome is a single element with children from the
parsing of the XML content. This is the reverse of the serialize
&component;.</para>

<para>When the text value is parsed, a document element wrapper must
be assumed so that element siblings can be parsed back into XML.
Further, if the 'namespace' parameter is specified, the default
namespace is declared on that wrapper element.</para>

<para>If the 'content-type' parameter is specified, an implementation
can use a different parser to produce XML content. Such a behavior is
implementation defined. For example, for the mime type 'text/html', an
implementation might provide an HTML to XHTML parser (e.g. Tidy).</para>

<p:declare-step type="p:parse">
  <p:input port="source" sequence="no"/>   
  <p:output port="result" sequence="no"/>
  <p:option name="namespace" required="no"/>  
  <p:option name="content-type" required="no"/>  
</p:declare-step>

<para>For example, with the 'namespace' parameter set to the XHTML namespace, the following input:</para>
<programlisting>&lt;description&gt;
&amp;lt;p&gt;This is a chunk.&amp;lt;/p&gt;
&amp;lt;p&gt;This is a another chunk.&amp;lt;/p&gt;
&lt;/description&gt;
</programlisting>
<para>would produce:</para>
<programlisting>&lt;description&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;This is a chunk.&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;This is a another chunk.&lt;/p&gt;
&lt;/description&gt;
</programlisting>

</section>


</section>

<!-- ************************************************************************-->
<!-- ************************************************************************-->
<!-- ************************************************************************-->

<section xml:id="std-optional">
<title>Optional Components</title>

<!-- ************************************************************************-->

<section xml:id="c.http-request">
<title>Http Request</title>

<para>The Http Request &component; provides interactions with resources identified by URIs over HTTP. The input document specifies the resource, options as to how the HTTP request is made, and possibly the content of the request.</para>

<p:declare-step type="p:http-request">
  <p:input port="source" sequence="no"/>   
  <p:output port="result" sequence="no"/>
  <p:option name="status-only" required="no" value="false"/> 
  <p:option name="override-mimetype" required="no"/> 
</p:declare-step>

<para>The input XML is structured as:</para>

<note role="editorial" xml:id="bad-formatting">
<para>The formatting of the XML input and output is crude and incomplete
in this draft.</para></note>

<programlisting><![CDATA[<c:http-request
  method = NCName
  href = anyURI
  status-only? = boolean
  override-mimetype? = string>
   (c:header*,
    c:entity?)
</c:http-request>

<c:header
  name = string
  value = string />

<c:entity
  content-type? = string
  set-content-length? = boolean>
   (c:body+)
</c:entity>

<c:body
  content-type? = string>
   (anyElement?)
</c:body>]]></programlisting>

<para>The component responds with an XML element structured as:</para>

<programlisting><![CDATA[<c:http-response
  status = integer>
   (c:header*,
    c:entity?)
</c:http-response>]]></programlisting>

<para>Any content returned that has an XML mime type is returned as a child of the 'body' element.  If the response is a text mime type and can be encoded in unicode, the content is encoded as the text children of the body element.  If the content is none of these, the response is encoded as base64 data textually represented as the text content of the body element.</para>

<para>The &component; may override the returned content type by the 'override-mimetype' option and the user may do the same via the 'override-mimetype' attribute.  If this value is specified, the returned content type header is ignored and the mime type specified is used to determine what to do with the output.  The original mime type is still provided in the response XML.</para>

<para>For example, a form post would be formulated as:</para>
<programlisting>&lt;c:http-request method="post" href="http://www.example.com/form-action" xmlns:c="http://www.w3.org/2007/03/xproc-component"&gt;
&lt;c:entity content-type="application/x-www-form-urlencoded"&gt;
&lt;c:body&gt;
name=W3C&amp;spec=XProc
&lt;/c:body&gt;
&lt;/c:entity&gt;
&lt;/c:http-request&gt;
</programlisting>
<para>and if the response was an XHTML document, the response would be:</para>
<programlisting>&lt;c:http-response status="200" xmlns:c="http://www.w3.org/2007/03/xproc-component"&gt;
&lt;c:entity content-type="application/xhtml+xml"&gt;
&lt;c:body&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;&lt;title&gt;OK&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;&lt;p&gt;OK!&lt;/p&gt;&lt;/body&gt;
&lt;/html&gt;
&lt;/c:body&gt;
&lt;/c:entity&gt;
&lt;/c:http-response&gt;
</programlisting>


</section>

<!-- ************************************************************************-->

<section xml:id="c.validate-relax-ng">
<title>Relax NG Validate</title>

<para>The Relax NG Validate &component; applies Relax validation to an XML document input. </para>

<p:declare-step type="p:validate-relax-ng">
  <p:input port="source" sequence="no"/>   
  <p:input port="schema" sequence="no"/>   
  <p:output port="result" sequence="no"/>   
</p:declare-step>

</section>

<!-- ************************************************************************-->

<!-- out of spec now
<section xml:id="c.xinclude-from-sequence">
<title>XInclude From Sequence</title>

<para>The XInclude &component; applies xinclude processing semantics
to the document. The referenced documents are only drawn from the
set of documents provided in the sequence on the 'documents' port.</para>

<p:declare-step type="p:xinclude-from-sequence">
  <p:input port="source" sequence="no"/>   
  <p:input port="documents" sequence="yes"/>   
  <p:output port="result" sequence="no"/>   
</p:declare-step>
</section>
-->

<!-- ************************************************************************-->

<section xml:id="c.validate-xml-schema">
<title>XML Schema Validate</title>

<para>The XML Schema Validate &component; applies XML Schema's validity assessment
to an XML document input. </para>

<p:declare-step type="p:validate-xml-schema">
  <p:input port="source" sequence="no"/>   
  <p:input port="schema" sequence="yes"/>   
  <p:output port="result" sequence="no"/>   
  <p:option name="assert-valid" value="true"/>
  <p:option name="mode" value="strict"/>
</p:declare-step>

</section>

<!-- ************************************************************************-->

<section xml:id="c.xslt2">
<title>XSLT 2.0</title>

<para>The XSLT 2.0 &component; applies an XSLT 2.0 transformation to a document.  The transformation is supplied on the port named 'transform' and the primary input document is supplied on the port named 'document'.  The application of
the transformation produces a sequence of documents on the output port named 'result'.</para>

<p:declare-step type="p:xslt2">
  <p:input port="source" sequence="yes"/>   
  <p:input port="transform" sequence="no"/>   
  <p:output port="result" sequence="yes"/>   
  <p:option name="initial-mode"/>
  <p:option name="template-name"/>
  <p:option name="allow-version-mismatch" value="true"/>
  <p:option name="output-base-uri"/>
  <p:option name="allow-collections" value="true"/>
  <p:parameter name="*"/>
</p:declare-step>

<para>If a sequence of documents is provided on the input port named 'source', the first document is assumed to be the primary input document.  By default, this sequence is also the default collection unless the 'allow-collections' parameter is set to 'false'.</para>

<para>All of the specified parameters are made available to the
XSLT processor. If the XSLT processor signals a fatal error, the &component; fails,
otherwise the result of the transformation is produced on the
<literal>result</literal> port.</para>

<para>The invocation of the transformation is controlled by the 'initial-mode' and 'template-name' parameter that set the initial mode and/or named template in the XSLT transformation that should initiate processing.  If these values do not match the transformation specified, a dynamic error must be thrown.</para>

<para>The 'allow-version-mismatch' parameter indicates whether an XSLT 1.0 transformation should be allowed to be run through the XSLT 2.0 processor.  A value of 'true' means that it should be allow.</para>

<para>The 'output-base-uri' parameter sets the context's output base URI per the XSLT 2.0 specification.</para>

<para>More than one document can be produced on the output port 'result'. In such cases, the principle result document will always appear <emphasis>last</emphasis>.</para>
</section>

<!-- ************************************************************************-->

<section xml:id="c.xsl-fo">
<title>XSL Formatter</title>

<para>The XSL Formatter &component; receives an XSL FO document and
renders the content.   The result of rendering is stored to the
uri provided via the 'uri' option.  A reference to that
result is produced on the output port.</para>
<para>The output content type is controlled by the 'output'
option which contains the mime type of the output format.  A formatter
may take any number of optional rendering parameters via the step's
parameters.  Such parameters are defined by the XSL implementation used and
are implementation defined.</para>

<p:declare-step type="p:xsl-formatter">
  <p:input port="source" sequence="no"/>   
  <p:output port="result" sequence="no"/>   
  <p:option name="uri" required="yes"/>
  <p:option name="output"/>
  <p:parameter name="*"/>
</p:declare-step>
<para>The output of this component is a document containing a single
element of the form:</para>
<programlisting><![CDATA[<c:result href = anyURI type = string/>]]></programlisting>
</section>


<!-- ************************************************************************-->

<section xml:id="c.xquery">
<title>XQuery 1.0</title>

<para>The XQuery 1.0 &component; applies an XQuery to a sequence of documents treated as the default collection.  The 'source' input port allows a sequence of documents and specifies each document that should be in the default collection.  The result of the xquery is a sequence of documents constructed from a XPath 2.0 sequence of elements that are assumed to be the document element of separate documents. </para>

<p:declare-step type="p:xquery">
  <p:input port="source" sequence="yes"/>   
  <p:input port="query" sequence="no"/>   
  <p:output port="result" sequence="yes"/>   
  <p:parameter name="*"/>
</p:declare-step>

<para>Since some queries do not start with an XML document element, a wrapper element of any 'query' in no namespace is allow and will be ignored by the component.   The serialization of the children of this element is the query text.  Any other element is assumed to be the start of a query with no prolog and the serialization of the document element is the query text.</para>

</section>

</section>
<!-- ************************************************************************-->
<!-- ************************************************************************-->
<!-- ************************************************************************-->

<section xml:id="std-micro-op">
<title>Micro-Operations Components</title>

<note>
<para>No decisions have been made about whether these components will be
optional or required.</para>
</note>

<!-- ************************************************************************-->

<section xml:id="c.delete">
<title>Delete</title>

<para>The Delete &component; deletes the matching items from the document on input port 'source' and outputs the results to the output port 'result'.  The matching items are specified via an XPath in the parameter named 'target'.</para>

<p:declare-step type="p:delete">
   <p:input port="source"/>   
   <p:output port="result"/>   
   <p:option name="target" required="yes"/>
</p:declare-step>

</section>


<!-- ************************************************************************-->

<section xml:id="c.insert">
<title>Insert</title>

<para>The insert &component; inserts a document specified on the
'insertion' port as a child of the target element in the document
specified  on the 'source' port.  The target and position of this 
insert is governed by the parameters.</para>

<p:declare-step type="p:insert">
   <p:input port="source"/>   
   <p:input port="insertion"/>   
   <p:output port="result"/>   
   <p:option name="target"/>
   <p:option name="at-start" required="yes"/>
</p:declare-step>

<para>The target of the insertion is specified via an XPath expression
in the 'target' option.  If no expression is supplied, the document
element is the target.</para>

<para>If the <parameter>at-start</parameter> option is true, the
insertion document will be inserted as the first child(ren) of the element,
otherwise it will be inserted as the last child. If the option
is not specified, a value of true is assumed.</para>

</section>

<!-- ************************************************************************-->

<section xml:id="c.label-elements">
<title>Label Elements</title>

<para>The Label Elements &component; labels each element with a unique xml:id value.  If the element already has an xml:id value, that value is preserved.  A user may specify the 'prefix' parameter for prefixing the value of the xml:id value.  This prefix does not affect existing xml:id values.</para>

<para>If an existing xml:id value conflicts with a previously generated value, the component fails.</para>

<p:declare-step type="p:label-elements">
   <p:input port="source"/>
   <p:output port="result"/>  
   <p:option name="prefix" required="no"/>
</p:declare-step>

</section>

<!-- ************************************************************************-->

<section xml:id="c.ns-rename">
<title>Namespace Rename</title>

<para>The Namespace Rename &component; renames any namespace declaration or use of a namespace in a document to a new URI value.  The source namespaces is identified by the 'from' parameter and the target namespace is identified by the 'to' parameter.  The 'from' parameter value may be a space separate list of URI values.</para>

<p:declare-step type="p:ns-rename">
   <p:input port="source"/>
   <p:output port="result"/>  
   <p:option name="from" required="yes"/>
   <p:option name="to" required="yes"/>
</p:declare-step>

</section>

<!-- ************************************************************************-->

<section xml:id="c.rename">
<title>Rename</title>

<para>The rename component renames elements or attributes in a
document based on parameter values.</para>

<p:declare-step type="p:rename">
   <p:input port="source"/>
   <p:output port="result"/>  
   <p:option name="target" required="no"/>
   <p:option name="name" required="yes"/>
</p:declare-step>

<para>Each element, attribute, or processing-instruction identified by the
XPath 1.0 expression specified by the 'target' parameter is renamed. The name
of elements and attributes, and the target of processing-instructions, are
changed to the value of the 'name' parameter.</para>

<para>The component fails if the specified name is not a valid name or if the
renaming would introduce a syntactic error into the document (i.e., if it would
create two attributes with the same name on the same element).</para>

</section>

<!-- ************************************************************************-->

<section xml:id="c.replace">
<title>Replace</title>

<para>The replace &component; replaces a target element in the input
document specified on the port named 'source' with the document element
of the document specified on the port named 'replacement'.  The result
is produces as a single document on the port named 'result'.</para>

<para>The target of the replace is specified via an XPath in the 'target' option that
must identify an element.  If the target identifies multiple elements, all the
elements are replaced.</para>

<p:declare-step type="p:replace">
   <p:input port="source"/>   
   <p:input port="replacement"/>   
   <p:output port="result"/>   
   <p:option name="target" required="no"/>
</p:declare-step>
</section>

<!-- ************************************************************************-->

<section xml:id="c.set-attributes">
<title>Set-attributes</title>

<para>The set-attributes component sets attribute values on the
document element using the attribute values provided on the document
element of the 'attribute' port's document.  That is, it copies the attributes on the document element from the 'attributes' input port to the document element of the 'source' input port.</para>

<p:declare-step type="p:set-attributes">
   <p:input port="source"/>   
   <p:input port="attributes"/>   
   <p:output port="result"/>   
</p:declare-step>

</section>
<!-- ************************************************************************-->

<section xml:id="c.unwrap">
<title>Unwrap</title>

<para>The Unwrap &component; removes the target and replaces it with its children within the input specified on the 'source' port with a new element.  The target is identified by an XPath parameter named 'target'.  A single document is produced on the output port named 'result'.</para>

<p:declare-step type="p:unwrap">
   <p:input port="source" sequence="no"/>
   <p:output port="result"/>  
   <p:option name="target" required="yes"/>
</p:declare-step>

</section>
<!-- ************************************************************************-->

<section xml:id="c.wrap">
<title>Wrap</title>

<para>The Wrap &component; wraps the target found with the input specified on the 'source' port with a new element.  The target is identified by an XPath parameter named 'target'.  The new element named via the 'name' parameter replaces the target in the input document where the target becomes the single child of the new element.  A single document is produced on the output port named 'result'.</para>

<p:declare-step type="p:wrap">
   <p:input port="source" sequence="no"/>
   <p:output port="result"/>  
   <p:option name="name" required="yes"/>
   <p:option name="target" required="yes"/>
</p:declare-step>

</section>
</section>

</appendix>
<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="references" version="5.0-extension w3c-xproc">

<title>References</title>

<bibliolist>
<bibliomixed xml:id="xml-core-wg"><abbrev>XML Core Req</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/proc-model-req/">XML
Processing Model Requirements</citetitle>.
Dmitry Lenkov, Norman Walsh, editors. W3C
Working Group Note 05 April 2004
</bibliomixed>

<bibliomixed xml:id="xml-infoset-rec"><abbrev>Infoset</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xml-infoset/">XML
Information Set (Second Edition)</citetitle>. John Cowan,
Richard Tobin, editors. W3C Working Group Note 04 February 2004.
</bibliomixed>

<bibliomixed xml:id="REC-xml"><abbrev>XML 1.0</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/REC-xml/">Extensible
Markup Language (XML) 1.0 (Fourth Edition)</citetitle>. Tim Bray,
Jean Paoli, C. M. Sperberg-McQueen, et. al.
editors. W3C Recommendation 16 August 2006.</bibliomixed>

<bibliomixed xml:id="xml11"><abbrev>XML 1.1</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xml11/">Extensible
Markup Language (XML) 1.1 (Second Edition)</citetitle>. Tim Bray,
Jean Paoli, C. M. Sperberg-McQueen, et. al.
editors. W3C Recommendation 16 August 2006.</bibliomixed>

<bibliomixed xml:id="xpath"><abbrev>XPath 1.0</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xpath">XML Path Language (XPath)
Version 1.0</citetitle>. James Clark and Steve DeRose, editors.
W3C Recommendation. 16 November 1999.</bibliomixed>

<bibliomixed xml:id="xslt10"><abbrev>XSLT 1.0</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xslt">XSL Transformations (XSLT)
Version 1.0</citetitle>. James Clark, editor.
W3C Recommendation. 16 November 1999.</bibliomixed>

<bibliomixed xml:id="xml-id"><abbrev>xml:id</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xml-id/">xml:id
Version 1.0</citetitle>. Jonathan Marsh, Daniel Veillard, and Norman Walsh, editors.
W3C Recommendation. 9 September 2005.</bibliomixed>

<bibliomixed xml:id="xml-base"><abbrev>XML Base</abbrev>
<citetitle xlink:href="http://www.w3.org/TR/xmlbase/">XML Base</citetitle>.
Jonathan Marsh, editor.
W3C Recommendation. 27 June 2001.</bibliomixed>

</bibliolist>
</appendix>
<appendix xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" xml:id="glossary"><title>Glossary</title><glosslist><glossentry><glossterm>pipeline</glossterm><glossdef><para>A <firstterm>pipeline</firstterm>
is a set of steps connected
together, with outputs flowing into inputs, without any loops (no step can
read its own output, directly or indirectly).</para><para>Note: defined but never referenced.</para></glossdef></glossentry><glossentry><glossterm>step</glossterm><glossdef><para>A <firstterm>step</firstterm> is
the basic computational unit of a pipeline.
Steps are either atomic or compound.</para><para>Note: defined but never referenced.</para></glossdef></glossentry><glossentry><glossterm>atomic step</glossterm><glossdef><para>An <firstterm>atomic step</firstterm> is a
step that performs a unit of XML processing, such as XInclude or
transformation.</para><para>Note: defined but never referenced.</para></glossdef></glossentry><glossentry><glossterm>compound step</glossterm><glossdef><para>