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:declare-step type="p:namespace-rename">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:option name="from"/> <!-- anyURI -->
   <p:option name="to"/> <!-- anyURI -->
   <p:option name="apply-to" select="'all'"/> <!-- "all" | "elements" | "attributes" -->

With the help of the <p:namespace-rename> step, namespace declarations can be renamed. The document to be used is indicated at the input port (“source“). The result of the entire operation is outputted at the ouput port (“result“). The “from“ option requires as content the namespace to be changed and the “to“ option requires the new value. By using the “apply-to“ option, it is possible to determine a filter which specifies whether elements, attributes or both shall be affected by the transformation.


In the following example a namespace shall be renamed. The namespace of the root element “FilmCollection“ is "http://www.films.com" and shall be renamed "http://www.betterfilms.com".

<FilmCollection xmlns="http://www.films.com">

The following XProc stylesheet is used:

<?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:output port="result"/>
   <p:namespace-rename from="http://www.films.com" to="http://www.betterfilms.com"/>

After the execution of the stylesheet, the root element of the output file is as follows:

<FilmCollection xmlns="http://www.betterfilms.com">