Error to execute my java class Test in the xsl with saxon from command line - Cannot find a matching 1-argument function named {var.www.html.Test}test()
First please note we aren't really using the forums on SourceForge any more, and comments here can easily get missed. Please use saxonica.plan.io in future (or StackOverflow if you prefer - you'll get more people responding that way).
Is it working if you only have the extension function calling AtomicInteger.getAndIncrement()? If that's the case then it must be a classpath issue with your test class. But I can't immediately see what the issue is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for response me. Yes, it is only working with AtomicInteger.getAndIncrement() but with my class does not work. I have set the variable $CLASSPATH and also in the command line but it does not work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I get the error
Cannot find a matching 1-argument function named {var.www.html.Test}test()
when i execute:
[tomcat@srvaxivln038 /**var/www/html] java -cp '.:./Test.class:./var/www/html/*:./saxon9.7.0.15.ee-sansservice.jar' net.sf.saxon.Transform FINAL1.xml transformation11.xsl -TJ -ext:on
I set the classpath from command line and also fron envirinment variable CLASSPATH
[tomcat@srvaxivln038 html]$ echo $CLASSPATH
/var/www/html/var/www/html/Test.class:/var/www/html/var/www/html/:/var/www/html/Test.class
Looks like that it can not find the class Test.
Could someone help me?
[tomcat@srvaxivln038 html]$ java -version
java version "1.7.0_75"
I show the files:
/var/www/html/var/www/html/Test.class
Test.java:
package var.www.html;
public abstract class Test {
public Test(){}
public static String test()
{
return "abc";
}
public static String test(String message){
return message;
}
public static int test(int message){
return message;
}
public static String myTest(String myString)
{
return myString;
}
public static void main(String[] args)
{
System.out.print("HELLO");
}
}
[tomcat@srvaxivln038 html]$ cat transformation11.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xf="http://nwalsh.com/xmlns/xslt20/extension/functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:counter="java:java.util.concurrent.atomic.AtomicInteger" **="" xmlns:xtestx="var.www.html.Test" **="" xmlns:acl="org.apache.commons.lang.StringUtils" xmlns:saxon="http://saxon.sf.net/">
<xsl:variable name="counter" select="counter:new(1)"/>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<xsl:variable name="count" select="counter:getAndIncrement($counter)"/>
Counter:<xsl:value-of select="$count"/>
<xsl:variable name="test2" select="xtestx:test($count)"/>
Value:<xsl:value-of select="$test2"/>
</html>
</xsl:template>
</xsl:stylesheet>
First please note we aren't really using the forums on SourceForge any more, and comments here can easily get missed. Please use saxonica.plan.io in future (or StackOverflow if you prefer - you'll get more people responding that way).
Is it working if you only have the extension function calling AtomicInteger.getAndIncrement()? If that's the case then it must be a classpath issue with your test class. But I can't immediately see what the issue is.
Hi Michael,
Thank you for response me. Yes, it is only working with AtomicInteger.getAndIncrement() but with my class does not work. I have set the variable $CLASSPATH and also in the command line but it does not work.