XProc steps

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

p:pack

<p:declare-step type="p:pack">
   <p:input port="source" sequence="true" primary="true"/>
   <p:input port="alternate" 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:declare-step>

With the help of the <p:pack> step, two documents can be combined (packed together). The documents to be combined are indicated at the respective input ports (“source“ and “result“). The “wrapper“ option is required because it determines the name of the enclosing element of the combined elements. By using the options “wrapper-prefix“ and “wrapper-namespace“, a prefix and an appropriate namespace can be assigned to the wrapper.

Example

Two documents shall be combined.

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
   <p:input port="source">
      <p:document href="FilmCollection.xml"/>
   </p:input>
   <p:output port="result"/>
   <p:pack wrapper="NewFilmElement">
      <p:input port="alternate">
         <p:document href="FilmCollection_2.xml"/>
      </p:input>
   </p:pack>
</p:declare-step>

In the example the documents “FilmCollection.xml“ and “FilmCollection_2.xml“ are combined. The “NewFilmElement“ element has been assigned as superordinated wrapper to the two documents.