So something you need for your XSLT transformation is in a Java class. How in the world are you suppose to call it? There are two approaches to this:
Approach 1:
http://stackoverflow.com/questions/13136229/solvedxslt-call-java-instance-method
As part of the namespace, you need to include the class you wish to call. Include the keyword java: before your full class name.
Note that when you call the method, it uses a : instead of a . between the class and the method name.
ie:
However if you get the following error..... then you're going to have to switch gears and go with....Basically, what is happening is you are using the free version of the Saxon parser and it doesn't support this type of declaration.
Approach 2:
In this approach, you basically have to explicitly register a ExtensionFunctionDefintion. This is basically the function interface definition...specifying the input/output and also the java logic you wish to use to calculate the result obj. Once done, just include the approach namespace (as you define in getFunctionQName()) and call the component like a regular xslt function.
http://www.saxonica.com/documentation/extensibility/integratedfunctions/ext-full-J.html
Approach 1:
http://stackoverflow.com/questions/13136229/solvedxslt-call-java-instance-method
As part of the namespace, you need to include the class you wish to call. Include the keyword java: before your full class name.
Note that when you call the method, it uses a : instead of a . between the class and the method name.
ie:
xmlns:SimpleDateFormat="java:java.text.SimpleDateFormat"
However if you get the following error..... then you're going to have to switch gears and go with....Basically, what is happening is you are using the free version of the Saxon parser and it doesn't support this type of declaration.
Note that direct calls to Java methods are not available under Saxon-HE
Approach 2:
In this approach, you basically have to explicitly register a ExtensionFunctionDefintion. This is basically the function interface definition...specifying the input/output and also the java logic you wish to use to calculate the result obj. Once done, just include the approach namespace (as you define in getFunctionQName()) and call the component like a regular xslt function.
http://www.saxonica.com/documentation/extensibility/integratedfunctions/ext-full-J.html