XSLTC does not support the xalan:component/xalan:script structure. Please
use the abbreviated syntax for Java extension.

Change your stylesheet like this:

<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns:myClass="MyCounter">

         <xsl:template match="/">
                 <h1><xsl:value-of select="myClass:myToString()"/></h1>
         </xsl:template>
</xsl:stylesheet>

Also be noted that XSLTC does not support extension elements. So the init
element in your MyCounter class will not work.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]



                                                                                
                                                    
                      Xserty                                                    
                                                    
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]     
                                          
                      >                        cc:                              
                                                    
                                               Subject:  Translet Extension 
Error                                                   
                      11/01/2002 12:04                                          
                                                    
                      PM                                                        
                                                    
                                                                                
                                                    
                                                                                
                                                    





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!");
   }
----------------------------------------------------------------------------------------





Reply via email to