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:escape-markup

<p:declare-step type="p:escape-markup">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:option name="cdata-section-elements" select="''"/> <!-- ListOfQNames -->
   <p:option name="doctype-public"/> <!-- string -->
   <p:option name="doctype-system"/> <!-- anyURI -->
   <p:option name="escape-uri-attributes" select="'false'"/> <!-- boolean -->
   <p:option name="include-content-type" select="'true'"/> <!-- boolean -->
   <p:option name="indent" select="'false'"/> <!-- boolean -->
   <p:option name="media-type"/> <!-- string -->
   <p:option name="method" select="'xml'"/> <!-- QName -->
   <p:option name="omit-xml-declaration" select="'true'"/> <!-- boolean -->
   <p:option name="standalone" select="'omit'"/><!-- "true" | "false" | "omit" -->
   <p:option name="undeclare-prefixes"/> <!-- boolean -->
   <p:option name="version" select="'1.0'"/> <!-- string -->
</p:declare-step>

The <p:escape-markup> step transforms the angle brackets (the markups) of all child elements of the root element read in (“source“) into their appropriate entitiy escape characters and then outputs this document at the output port (“result“). Furthermore, the user has a whole series of options which influence the escape behaviour of this step. The options will not be discussed in any further detail here.

Example

The known document (“FilmCollection.xml“) is send through a <p:identity> step, but at first through a <p:escape-markup> step.

<?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:escape-markup/>
   <p:identity/>
</p:declare-step>

Any child elements of “FilmCollection“ are replaced by their entity escape characters. The result of this procedure is as follows (excerpt):

&lt;FilmCollection&gt;
  &lt;Film&gt;
    &lt;Title&gt;Star Wars: Episode IV - A New Hope&lt;/Title&gt;
    &lt;Year&gt;1978&lt;/Year&gt;
    &lt;Genre&gt;SciFi&lt;/Genre&gt;
[...]