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:rename">
  <p:input port="source"/>
  <p:output port="result"/>
  <p:option name="match" required="true"/> <!-- XSLTMatchPattern -->
  <p:option name="new-name" required="true"/> <!-- QName -->
  <p:option name="new-prefix"/> <!-- NCName -->
  <p:option name="new-namespace"/> <!-- anyURI -->

With the help of <p:rename>, elements, attributes or processing information can be renamed within a document. The attribute values “match“ and “new-name“ are obligatory. In order to determine which target of the source document shall be processed, a XSLT pattern has to be indicated when using “match“. The new identification is declared under “new-name“. New namespaces and prefixes can be assigned to the new identifications when using the optional indications of “new-namespace“ and “new-prefix“.


In the following example the “Cast“ element shall be renamed as “Besetzung“ (which is the German word for "cast").

<?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:document>
   <p:output port="result"/>
   <p:rename match="/FilmCollection/Film/Cast" new-name="Besetzung"></p:rename>

A XSLT-typical query value has to be passed on to the “match“ attribute of <p:rename>. Which means that all “Cast“ elements of the document shall become part of the processing. “new-name“ determines that all “Cast“ elements shall be renamed as “Besetzung“.