Home · Blog · Planet Digital Humanities

David Maus M. A.

Digital Humanities Publishing

Provide a random UUID to XSLT with XProc <p:uuid>

David Maus, 19.02.2018 · Twitter · Comment · Permalink

Create a step that acts as source of the UUID. The step provides an XML document with a single uuid-element at its primary output port result. The uuid has a single attribute value which contains the UUID as value.

<p:uuid version="4" match="@value" name="uuid-source">
<p:input port="source">
<p:inline>
<uuid value=""/>
</p:inline>
</p:input>
</p:uuid>

Connect the step to the p:with-param inside the p:xslt step.

<p:xslt>

<p:with-param name="uuid" select="/uuid/@value">
<p:pipe step="uuid-source" port="result"/>
</p:with-param>

</p:xslt>

Done.