[xsl] calling java methods from a stylesheet

Subject: [xsl] calling java methods from a stylesheet
From: Garvin Riensche <g.riensche@xxxxxxx>
Date: Mon, 21 Sep 2009 19:55:16 +0200
Hi there,

i have some stylesheets which were written to be processed by the xalan processor. Now I want to switch to saxon. These stylesheets contain java methods that should be executed. Therefore they include the following namespace "xmlns:java="http://xml.apache.org/xslt/java";. The .jar file which holds the java classes is included in the classpath. A method call looks like the following:

<xsl:value-of select="java:de.novum.vger.util.DateUtil.getTodayString()" />

which works fine with xalan.

How can I make these stylesheets work with saxon without changing too much?

I thought it would work like this:

add namespace: xmlns:java="java:de.novum.vger.util.DateUtil"
call method:
<xsl:value-of select="java:getTodayString()" />

but I get the following error:
Error at xsl:value-of on line 40 column 84 of stylesheet_leistungsfall_variabel_dta.xsl
XPST0017: XPath syntax error at char 21 on line 40 in {java:getTodayString()}:
Cannot find a matching 0-argument function named
{java:de.novum.vger.util.DateUtil}getTodayString()


Why does saxon not find the class, although the jar-file containing it is in the classpath?

regards,
Garvin

Current Thread