Hi
I am using TS 6.7.1 Sp1 xslt PT feature on Win 2000 server.
I am in the process of converting some of my tpls to xslt.
There are some java classes which connect to the database which I would like to call from xslt templates.
This is where the trouble starts .
I am able to use built in java classes like java.lang.Math and call there static functions but when I try to use my own classes I am faced with this ERROR in servletd_out.log file, and I am not able preview or generate.
(Location of error unknown)java.lang.NoSuchMethodException: For extension function, could not find method java.lang.Double.calculate([ExpressionContext,] ).
I am not sure as to what place should I place my java code , I have placed them under
/custom/ and added /custom to my CLASSPATH environmental variable.
Java file
======
[php]
package com.citi.math;
import java.math.BigInteger;
class FibonacciNumber {
public static BigInteger calculate(int n) {
if (n <= 0) {
throw new IllegalArgumentException(
"Fibonacci numbers are only defined for positive integers"
);
}
BigInteger low = BigInteger.ONE;
BigInteger high = BigInteger.ONE;
for (int i = 3; i <= n; i++) {
BigInteger temp = high;
high = high.add(low);
low = temp;
}
return high;
}
}
[/php]
XSLT Template
===========
[php]
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:fib="xalan://com.citi.math.FibonacciNumber"
>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
[/php]
If any body has a working example of how to call a java class using xalan please reply .