I'm trying to use the XSLT Mediator but when taking a value, i'd like to apply a custom groovy function to it. For example:
<script language="groovy">
def myfunction(value) {
return "A B C";
}
</script>
<xsl:template match="/">
<urn:item>
<urn:productName>
<xsl:value-of select="myfunction(PRODUCTNAME)"/>
</urn:productName>
</urn:item>
</xsl:template>
The error i'm getting is: net.sf.saxon.trans.XPathException: Cannot find a matching 1-argument function named myfunction()
As i read, Saxon HE (the default xslt processor in wso2esb) is not able to call extension functions but Saxon PE or EE does.
I follow steps detailed here (http://nandikajayawardana.blogspot.com.ar/2012/12/how-to-replace-saxonhe940wso2v1jar-in.html) but same error.
My question is: Is there another way to do what i need? How can i know that wso2 esb is loading properly Saxon EE?
Thank you very much for your help!
Regards, R.
=====================================================
Solved!
Follow @Carpentidge steps to install Saxon EE in WSO2ESB.
Following @MichaelKay link, i used Java to do what i need
First, download common-lang3.jar.zip and copy the .jar file into repository/components/lib. Then, modify the xslt as follows:
<xsl:template match="/">
<xsl:variable name="pn" select="CSITPRODUCTNAME"/>
<urn:item>
<urn:productName>
<xsl:value-of select="lang:unescapeHtml($pn)" xmlns:lang="java:org.apache.commons.lang.StringEscapeUtils"/>
</urn:productName>
</urn:item>
</xsl:template>
Thank you both for your help @Carpentidge and @MichaelKay