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

<p:viewport
   name? = NCName
   match = XSLTMatchPattern>
  ((p:viewport-source? &
   p:output? &
   p:log?),
   subpipeline)
</p:viewport>

With the help of the <p:viewport> Compound Step, certain parts of a document can be selected by an appropriate XSLT expression in order to process them later in a subpipeline. Alternatively, the desired content can also be provided by <p:viewport-source>.

<p:viewport-source>
   (p:pipe |
    p:document |
    p:inline |
    p:data)?
</p:viewport-source>

<p:viewport-source> is only available as part of <p:viewport>. Here, a document must be indicated. This can be realised by the elements <p:pipe>, <p:document>, <p:inline> or <p:data>. If no document is indicated, a dynamic error will be outputted.

Example

In the following example only part of the initial document shall be processed.

<?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:viewport match="/FilmCollection/Film/Title">
      <p:wrap match="/" wrapper="test"></p:wrap>
   </p:viewport>
</p:declare-step>

The XSLT expression in the “match“ attribute of the <p:viewport> step addresses all “Title“ elements of the source document. This part of the document is now passed on into the subpipeline of <p:viewport>, in the example only the <p:wrap> step. There, all “Title“ elements are renamed “test".