cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Illegal number of arguments passsed to the function call

0 Kudos

HI All,

In our scenario we are using XSLT mapping with java enhancement.Its working fine in Stylus studio but when the same is imported into XI its throwing the below mentioned error:

javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Illegal number of arguments or types of arguments in a call of function 'Trans:Convert'.

Our requirement is that we are summing up the field "Grant_Amount" which occurs multiple times in the source structure and the sum is mapped to the field "Sum' on the target side.The stylesheet is working fine in stylus studio but whe imported into XI the above mentioned error is being thrown.Can any one one please help me solving this issue.

The XSL, the source XMLand the java class are mentioned below:

<

XSL:

===

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.infosys.com/sap/xi/projects/sce/n1" xmlns:Trans="com.company.group.String2Number">

<xsl:template match="/">

<a:MT_TargetXSLJava>

<Record>

<Detailrecord>

<Sum>

<xsl:value-of select="Trans:Convert(//Grant_Amount)"/>

</Sum>

<Flag>

<xsl:text>1</xsl:text>

</Flag>

</Detailrecord>

</Record>

</a:MT_TargetXSLJava>

</xsl:template>

</xsl:stylesheet>

XML:

===

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_SourceXSLJava xmlns:ns0="http://www.infosys.com/sap/xi/projects/sce/n1">

<Recordset>

<DETAILRECORD>

<Grant_Amount>$100.00</Grant_Amount>

</DETAILRECORD>

<DETAILRECORD>

<Grant_Amount>$200.00</Grant_Amount>

</DETAILRECORD>

<summary_record>

<Total>$300.00</Total>

</summary_record>

</Recordset>

</ns0:MT_SourceXSLJava>

Java Code:

========

package com.company.group;

public class String2Number

{

public static double Convert(String[] a)

{

double sum=0;

String[] temp = new String100;

for(int i=0;i<a.length;i++)

{

temp = (a).replaceAll(",
$

"","");

{

sum=sum+Double.parseDouble(temp);

}

}

return sum;

}

}

Please guide me to the right solution.

Thanks and Regards,

Karanam

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If you are using below mentioned java code for Convert method, then see you are passing a String Array, but in below statement:

<xsl:value-of select="Trans:Convert(//Grant_Amount)"/>

This is just a single value i think, you have to pass an array with values 100,200,300. Pls check it.

BR,

Alok