Hi,
I am using version 2.6.0 of Xalan/XSLTC for carrying
out XSL
transformations using translets. Problem arises when I
try to compile my xsl file
to a translet. The following part in the XSL fails
compilation -
<xsl:otherwise>
<xsl:variable name="number"
select="EMPDB_2472Group/EMPDB_2472[position()=$feepos]
* 0.9"/>
<xsl:variable name="roundnumber" select="5"/>
<xsl:variable name="flag" select="0"/>
<xsl:variable name="output"
select="util:RND1($number,$roundnumber,$flag)"/>
<xsl:if test="$output != ''">
<xsl:value-of
select="format-number($output,'$##,###,##0.00')"/>
</xsl:if>
</xsl:otherwise>
with the error like :
ERROR: 'Cannot convert argument/return type in call
to method
'X.Y.Z.XSLUtils.RND1(real, int, real)''
FATAL ERROR: 'Could not compile stylesheet'
Exception:
javax.xml.transform.TransformerConfigurationException:
Could
not compile stylesheet
javax.xml.transform.TransformerConfigurationException:
Could not
compile stylesheet
at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.ja
va:753)
at XSLCompiler.generateXSLClassFile(Unknown
Source)
at XSLCompiler.main(Unknown Source)
The java method which I am trying to invoke is -
public static String RND1(String number, String
roundnumber, String
flag) {
double temp = 0;
double num = Double.parseDouble(number);
double roundnum =
Double.parseDouble(roundnumber);
temp = num % roundnum;
if (temp == 0)
num = num;
else {
if (flag.equals("1")) {
temp = roundnum - temp;
num = num + temp;
} else if (flag.equals("0")) {
num = num - temp;
} else if (flag.equals("2")) {
double temp1 = 0.0;
temp1 = (num / roundnum) % 1;
if (temp1 > 0.4) {
temp = roundnum - temp;
num = num + temp;
} else {
num = num - temp;
}
}
}
log("******** XSLUtils Log Rounding " +
number + " " + num);
return num + "";
}
I have made sure that correct files are in the
classpath. When I do the
following chage in the xsl above, the compilation goes
through -
<xsl:variable name="roundnumber" select="a"/>
<xsl:variable name="flag" select="b"/>
It seems there is some problem with passing the
integer values to the
java method. But other such java methods are working
fine in the same
xsl.
Am I missing something obvious ?
Please advice.
Thanks.
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail