Skip to content

Latest commit

 

History

History

InvokeJavaFunctionsFromXSLT30

Invoke Java functions from XSLT Mapping

| Recipes by Topic | Recipes by Author | Request Enhancement | Report a bug | Fix documentation |

Kamlesh Zanje Kamlesh Zanje

Writing reflexive extension functions in Java to be invoked from XSLT Mappings.

Download the integration flow Sample

Recipe

Step Code Why?
Extensibility capability - Java function call <xsl:template match="/" xmlns:date="java:java.util.Date"> <xsl:value-of select="date:new()"/> </xsl:template> Writing reflexive extension functions in Java

References

Sample integration flow

The integration flow depicted in the recipe is very simple which contains start timer and XSLT Mapping step through which we can leverage the invocation of java function call from XSLT script. iflowimage

Sample Script

This is the script used in the sample integration flow which starts with namespace declaration and then invokes the java function which display the current date.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/"
        xmlns:date="java:java.util.Date">
    <xsl:value-of select="date:new()"/>
	</xsl:template>
</xsl:stylesheet>

Sample Output

Output of the Java function invocation from the XSLT script can be experienced in the Monitor's message processing view. Output Image