You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Xserty <xs...@libero.it> on 2002/11/01 18:04:46 UTC

Translet Extension Error


Hi!
         I'm new to Xalan, and I'm trying to compile a stylesheet with a 
Java extension.
This stylesheet with Java extension works fine if I transform it using the 
TrAX.
If I try to compile it as a Translet, I get the following error message 
from the getErrors()
vector:
Cannot find external method 'myToString' (must be public).
(It is public and it's in my CLASSPATH)

I've searched through the mailling list archives, but I didn't find an answer!

Hope to hear from you and thanks in advance! ;))
         Xserty


PS: I include, in this email, the involved bits of files for further 
information:

----------------------------------------XSL 
file---------------------------------
<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:xalan="http://xml.apache.org/xalan"
                 xmlns:myClass="MyCounter"
                 extension-element-prefixes="myClass">
         <xalan:component prefix="myClass" functions="myToString">
                 <xalan:script lang="javaclass" src="xalan://MyCounter"/>
         </xalan:component>
         <xsl:template match="/">
                 <h1><xsl:value-of select="myClass:myToString()"/></h1>
         </xsl:template>
</xsl:stylesheet>
--------------------------------------------------------------------------------------

--------------------------------JAVA class (MyCounter)------------------
[...]
public class MyCounter {
[...]
   public MyCounter ()
   {}
   public void init (XSLProcessorContext context, ElemExtensionCall extElem)
   { [...] }
   public String myToString() {
     return("This is MyCounter!");
   }
----------------------------------------------------------------------------------------