Previous Up Next


p:uuid

p:uuid — Generates a UUID and inserts it into a document.

Synopsis

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

Description

The p:uuid step generates a [UUID] and injects it into the input document at the location(s) specified by the match option. If the version is specified, that version of UUID must be computed.

All implementations support version 4 UUIDs (the random-number based version). Support for other versions of UUID, and the mechanism by which the necessary inputs are made available for computing other versions, is implementation-defined.

Each matching node in the source document is replaced by the UUID (if more than one node matches, the same UUID value is used as the replacement each time). If the matched node is an attribute, then the UUID is used as the new attribute value, in all other cases, the entire node is replaced.

Errors

Error Description
err:C0060 Occurs if the processor does not support the specified version of the UUID algorithm.

Examples

This example uses a UUID to generate a globally unique identifier.

  1 <p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                version="1.0">
  5 
      <p:uuid match="/doc/id/text()" version="4"/>
    </p:pipeline>
Input Output
1 <doc xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<id>@@</id>
<p>Some text.</p>
5 </doc>
 
1 <doc xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<id>0947b3e4-ed36-48da-9591-102a992d8bc4</id>
<p>Some text.</p>
5 </doc>