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="/">
<xsl:variable name="uid" select="uuid:randomUUID()"/>
<xsl:value-of select="$uid"/>
</xsl:template>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…