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:unwrap

<p:declare-step type="p:unwrap">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:option name="match" required="true"/> <!-- XSLTMatchPattern -->
</p:declare-step>

With the help of the <p:unwrap> step, enclosing elements can be removed. These elements will be replaced by their appropriate child elements. The enclosing element to be removed is defined by a XSLT expression. The source document is read in via the input port (“source“). The output is done via the output port (“result“).

Example

In the following example the enclosing “Cast“ elements shall be removed from the known document (“FilmCollection.xml“), so that the appropriate child elements (“LeadingActor“) can replace the enclosing elements.

<?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:unwrap match="Cast"/>
</p:declare-step>

After the execution of this process, the result is as follows (excerpt):

<Producer>George Lucas</Producer>
   <LeadingActor>Mark Hamill</LeadingActor>
   <LeadingActor>Harrison Ford</LeadingActor>
   <Duration>121 min</Duration>
[...]

The enclosing “Cast“ element has been removed.