Himanshu Yadav
Himanshu Yadav

Reputation: 13585

Calling Java Methods in XSLT

Trying to generat a random number with the help of Java UUID class.

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="xs" xmlns:uuid="java:java.util.UUID">
<xsl:template match="/">
<xsl:variable name="uid" select="uuid:randomUUID()"/>
<ClientPK><xsl:value-of select="$uid"/></ClientPK>

Error

Cannot find a matching 0-argument function named {java:java.util.UUID}randomUUID().
  Note that direct calls to Java methods are not available under Saxon-HE

Upvotes: 2

Views: 4279

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

See http://saxonica.com/documentation/index.html#!extensibility, if you want to use Saxon 9 and have that feature (called reflexive extension functions) you need a license for PE or EE.

Upvotes: 4

Related Questions