You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Mariella Di Giacomo <ma...@lanl.gov> on 2002/11/15 16:57:56 UTC

Re: XSLTC, abbreviated syntax for extension implemented in Java and Compiler error(s): Cannot find external method ...

Hi,

I am sorry for the "." after the package name but it is a typo.
I have tried also what you have written in the email, but I still get

java org.apache.xalan.xsltc.cmdline.Compile xslt_functions.xsl
Compiler error(s):
   Cannot find external method 'parseQuery.new' (must be public).
   Cannot find external method 'getVdkKey' (must be public).
   Cannot find external method 'getSessionId' (must be public).

Could you please help ?
Thanks,

Mariella


This is how the xsl file looks like

_____________________________
<?xml version="1.0"?>
<xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

     xmlns:xalan="http://xml.apache.org/xalan"
     xmlns:XSLTFunctionsPackage="xalan://pack1.team.xsltfunctions"
     version="1.0">

   <xsl:variable name="myType" select="XSLTFunctionsPackage:parseQuery.new()"/>

    <xsl:variable name="vdkKey" 
select="XSLTFunctionsPackage:getVdkKey($myType)"/>
   <xsl:variable name="tmpFileName" 
select="XSLTFunctionsPackage:getSessionId($myType,$vdkKey)"/>

</xsl:stylesheet>

__________________________________________

This is how the Java class looks like:
_____________________________________________________


package pack1.team.xsltfunctions;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class parseQuery extends HttpServlet {

   static String mVdkKey = "";
   static String mRestOfUrl = "";
   static String mSessionId = "";
   static String mDbsSearched = "";



   public void parseQuery()
     {}

   public void setVdkKey(String pVdkKey) {
          mVdkKey = pVdkKey;
   }

  public String getVdkKey() {
          return mVdkKey;
     }



  public String getSessionId() {
          return mSessionId;
   }

................
}

________________________________________________________

The JAVA classpath contains the pathname of the jar file
that contains that class.


At 09:58 AM 11/15/02 -0500, mkwan@ca.ibm.com wrote:
>Hi,
>
>You are not using the namespace format correctly. Please remove the last
>dot from xmlns:XSLTFunctionsPackage="xalan://pack1.team.xsltfunctions.".
>Also if "pack1.team.xsltfunctions" is a package name, then "
>XSLTFunctionsPackage:new()" is not valid syntax. You cannot invoke a
>constructor on a package. The other issue is for an instance method, you
>should not prepend the class name to the extension function. In this case
>the class name is determined from the first argument to the extension
>function.
>
>The correct usage should look like this:
>
>xmlns:XSLTFunctionsPackage="xalan://pack1.team.xsltfunctions"
>
><xsl:variable name "myType" select="XSLTFunctionsPackage:parseQuery.new()">
><xsl:variable name="vdkKey" select="XSLTFunctionsPackage:getVdkKey
>($myType)"/>
>
>  <xsl:variable name="tmpFileName"
>select="XSLTFunctionsPackage:getSessionId($myType, $vdkkey)"/>
>
>
>Morris Kwan
>XSLT Development
>IBM Toronto Lab
>Tel: (905)413-3729
>Email: mkwan@ca.ibm.com
>
>
>
> 
>
>                       Mariella 
> Di 
>
>                       Giacomo                  To: 
> xalan-dev@xml.apache.org
>                       <mariella@lanl.go        cc: 
 >
>                       v>                       Subject:  XSLTC, 
> abbreviated syntax for extension implemented in Java  and Compiler
>                                                 error(s):  Cannot find 
> external method ...
>                       11/14/2002 
> 07:32 
>
>                       PM 
 >
>                       Please respond 
> to 
>
>                       xalan-dev 
 >
> 
>
> 
>
>
>
>
>
>
>
>Hello,
>
>I was trying to compile using org.apache.xalan.xsltc.cmdline.Compile
>(version
>1.2) an XSL file on Solaris 2.8 and xalan 2.4.0
>I am using the abbreviated syntax for extension functions implemented in
>Java.
>
>I have tried the possible cases that are described in the documentation and
>I
>always get the same error:
>
>Compiler error(s):
>  Cannot find external method 'parseQuery.getVdkKey' (must be public).
>  Cannot find external method 'parseQuery.getSessionId' (must be public).
>
>1) package format
>The java classes I am using belong to a package
>called "pack1.team.xsltfunctions"
>All the Java methods are public.
>The first returns a String
>The second takes a String and returns a String
>
>The file1.xsl looks like:
>
>__________________
>
><?xml version="1.0"?>
><xsl:stylesheet
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
>xmlns:xalan="http://xml.apache.org/xalan"
>xmlns:XSLTFunctionsPackage="xalan://pack1.team.xsltfunctions."
>
><xsl:variable name "myType" select="XSLTFunctionsPackage:new()">
><xsl:variable name="vdkKey" select
>="XSLTFunctionsPackage:parseQuery.getVdkKey
>($myType)"/>
>
>  <xsl:variable name="tmpFileName"
>select="XSLTFunctionsPackage:parseQuery.getSessionId($myType, (string)
>$vdkkey)"/>
>
></xsl:stylesheet>
>________
>
>2) package format and I made the Java classes
>as public static methods
>
>The file1.xsl looks like
>
>____________
>
><?xml version="1.0"?>
><xsl:stylesheet
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
>xmlns:xalan="http://xml.apache.org/xalan"
>xmlns:XSLTFunctionsPackage="xalan://pack1.team.xsltfunctions."
>
><xsl:variable name="vdkKey" select
>="XSLTFunctionsPackage:parseQuery.getVdkKey
>()"/>
>
>  <xsl:variable name="tmpFileName"
>select="XSLTFunctionsPackage:parseQuery.getSessionId((string)$vdkkey)"/>
>
>
></xsl:stylesheet>
>
>_______
>I get the same errors
>
>3)
>I have tried the "Class format" Name Space and I get the same errors.
>
>Could you please tell me what is wrong ?
>Could you please help ?
>
>Thanks,
>
>Mariella