0

It works fine if remove reference to Java class from xslt.
XSLT

<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:for-each select="Client">
            <xsl:variable name="uid" select="uuid:randomUUID()"/>

Groovy

import java.util.UUID

TransformerFactory.newInstance()
                  .newTransformer( new StreamSource( new StringReader( xslt ) ) )
                  .transform( new StreamSource( new StringReader( xmlAsString ) ),
                              new StreamResult( w ) )

Exception

ERROR:  'Cannot find class 'java:java.util.UUID'.'
FATAL ERROR:  'Could not compile stylesheet'
Caught: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet

2 Answers 2

1

I believe it should be:

xmlns:uuid="java://java.util.UUID"
Sign up to request clarification or add additional context in comments.

Comments

0

Issue was with xmlns:uuid="java:java.util.UUID" I got from one of the blog post.
Updated it to xmlns:uuid="java.util.UUID" and it worked fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.