Monday, August 19, 2013

How to call an external java function with Xalan processor

How to call an external java function with Xalan processor

I'm having trouble to call an external java function in my XSL code with
Xalan processor.
The error I get is :
Exception in thread "main" java.lang.RuntimeException:
java.lang.NoSuchMethodException: For extension function, could not find
method
org.apache.xml.utils.NodeVector.incrementPropertyId([ExpressionContext,]
).
I have a java class named Util.java in the folder where I execute my
compile command.
In my xsl file, I've declared my namespace as follow :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java"
xmlns:util="xalan://Util">
And I call my function using :
<xsl:copy-of select="incrementPropertyId(blablabal)"/>
So I suppose my problem comes from my namespace, but what is wrong with it ?
Also, It's a xsl 1.0 stylesheet.
Thanks for your help
Edit :
In my Util.java file, I have no package declared since I'm at the root...
should I add a package Util; definition to my class ?

No comments:

Post a Comment