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

<p:declare-step type="p:uuid">
   <p:input port="source" primary="true"/>
   <p:output port="result"/>
   <p:option name="match" required="true"/> <!-- XSLTMatchPattern -->
   <p:option name="version"/> <!-- integer -->
</p:declare-step>

With the help of the <p:uuid> step, a dynamically generated random number, an “UUID“ (Iniversally Unique Identifier), can be integrated into the XML document to be read in. The position where the UUID shall be placed is defined by a XSLT expression. The “version“ option indicates which version of the UUID algorithm shall be used. If the used XProc processor does not know the selected version, the respective default value is used.

Example

In the following example, UUIDs are assigned to the “Title“ elements.

<?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:uuid match="/FilmCollection/Film/Title/@id"/>
</p:declare-step>

In order to illustrate the meaning of this step, the “Title“ element is extended by the “id“ attribute.

<Title id="">Unforgiven</Title>

After the execution of this process, all "id" attributes of the "Title" element are filled with an UUID.

<Title id="66189802-d5d4-4a3b-ba52-f75c39a7403f">Unforgiven</Title>