Previous Up Next


p:wrap-sequence — Places an element wrapper around a sequence of documents.


<p:declare-step type="p:wrap-sequence">
     <p:input port="source" sequence="true"/>
     <p:output port="result" sequence="true"/>
     <p:option name="wrapper" required="true"/>                    <!-- QName -->
     <p:option name="wrapper-prefix"/>                             <!-- NCName -->
     <p:option name="wrapper-namespace"/>                          <!-- anyURI -->
     <p:option name="group-adjacent"/>                             <!-- XPathExpression -->


The p:wrap-sequence step is something like the p:wrap step except that instead of operating on nodes within a document, it operates on a sequence of documents.

In the simple case, the p:wrap-sequence step turns a sequence of documents into a single document; it creates a new document element and inserts the content of each document in the sequence into the new element. In the not so simple case, the group-adjacent expression can be used to group the documents in a sequence.

The name of the wrapper is computed from the wrapper, wrapper-prefix, and wrapper-namespace options. If the wrapper value contains a colon, then its value is interpreted as a QName and there must be an in-scope namespace declaration for that prefix in the pipeline document. It is an error in this case to specify either a wrapper-prefix or wrapper-namespace.

The group-adjacent option can be used to group adjacent documents. For each input document, the group-adjacent expression is evaluated with the input document as the context. Whenever two or more sequentially adjacent documents yield the same value for the group-adjacent option, they are wrapped together.

The context position (position()) is the position of that document within the sequence and the context size (last()) is the total number of documents in the sequence.


Error Description
err:D0034 Occurs if either wrapper-namespace or wrapper-prefix are specified when the wrapper name contains a colon.


FIXME: TBD. (The harness that runs examples for the book doesn't have any way of taking in a sequence of documents.)