[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem in compiling XSL to translet - fails at Java

Subject: Problem in compiling XSL to translet - fails at Java method
From: XSLT C <xsltc@xxxxxxxxx>
Date: Mon, 23 Aug 2004 15:34:24 -0700 (PDT)
could not compile stylesheet
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.