XSLT generate UUID

Here’s a good example. Basically you set up an extension that points to the java UUID class, and then reference it in the XSL:

<xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:uuid="java:java.util.UUID">
<xsl:template match="https://stackoverflow.com/">
  <xsl:variable name="uid" select="uuid:randomUUID()"/>
  <xsl:value-of select="$uid"/>
</xsl:template>

Leave a Comment