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

<p:declare-step type="p:unescape-markup">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:option name="namespace"/> <!-- anyURI -->
   <p:option name="content-type" select="'application/xml'"/> <!-- string -->
   <p:option name="encoding"/> <!-- string -->
   <p:option name="charset"/> <!-- string -->
</p:declare-step>

The <p:unescape-markup> step is the counterpart to <p:escape-markup>. It transforms all entity escape characters into their appropriate Unicode characters. The user is provided with four options which control the behaviour of the step. In this way, a standard namespace can be defined by the “namespace“ option. The “content-type“ option informs the processor about the type of the document (the standard is XML) and also about how the respective transformations shall be performed. The options “encoding“ and “charset“ indicate which type of coding and which character set is used. These indications can be relevant for the transformation behaviour, depending on the case. All options are optional. The initial document is indicated at the input port (“source“). The result is outputted at the output port (“result“).

Example

A document previously transformed by <p:escape-markup> shall be retransformed into its original state by <p:unescape-markup>.

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

The output after the <p:escape-markup> step 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;
[...]

The output after the <p:unescape-markup> step is as follows (excerpt):

<FilmCollection>
   <Film>
      <Title>Star Wars: Episode IV - A New Hope</Title>
      <Year>1978</Year>
      <Genre>SciFi</Genre>
[...]