Reputation: 135
I am quite new to XSLT and quite confused on how to use java inside XSLT. I have an XSL template that will transform one XML to another. My requirement is to access an external java class method in my XSLT. I have a java class called FileCopy and its method is copyFile(). I need a way to access the copyFile() method inside my XSLT.
Upvotes: 2
Views: 4417
Reputation: 2001
You have to bind the extensions to the stylesheet. It should be via namespaces, class names, and the Java class path.
For example, define your class:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:filecopy="java:com.test.FileCopy"
exclude-result-prefixes="filecopy">
and then you can use it:
<xsl:value-of select="filecopy:copyFile($params)"/>
More information is here
Upvotes: 3