David,

I believe the documentation needs to be updated to describe the legal type conversions between internal types and Java types (and vice-versa). The rules are not the same for Xalan and XSLTC. In particular, XSLTC does not convert to or from Number, and in general it prefers primitive over "boxed" types. Try replacing Number by the primitive type double. If you have the sources, you can check the table of allowed conversions in org.apache.xalan.xsltc.compiler.FunctionCall in the static block defined near line 160.

 Hope this helps.

-- Santiago

On Aug 31, 2004, at 3:38 AM, Perez Carmona, David wrote:


Hi all,

I have this Java class

public class Tbl {
  public static Number getAncho(Number anchoCols, Number numCols);
  ....
}

and this stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:tbl="xalan://fcc.ima.pdf.Tbl">

<xsl:template match="a">
<xsl:variable name="v-anchos">
<xsl:for-each select="vista">
<ancho><xsl:value-of select="tbl:getAncho(sum(columnado/columna/@ancho), count(columnado/columna))"/></ancho>
</xsl:for-each>
</xsl:variable>
.....
</xsl:template>


</xsl:stylesheet>

Under the interpretative Xalan, I can call this extension function ok, but under XSLTC it fails, this is the message I get:

javax.xml.transform.TransformerException: Cannot conver the argument/return value in the method call 'fcc.ima.pdf.Tbl.getAncho(real, int)'

Is this a bug? Is XSTLC incompatible with Xalan-Java Interpretive processor?. I've read the doc and this can be done with both.

I'm using Xalan 2.6.0, Java 1.4.2 and used the endorsed mechanism.

Any hint will be greatly appreciated.

Regards,
     David

*************************************************************
Este correo ha sido procesado por el Antivirus del Grupo FCC
*************************************************************



Reply via email to