Re: [xsl] Calling a java method in XSL 1.0 with Saxon 6.5.5 fails

Subject: Re: [xsl] Calling a java method in XSL 1.0 with Saxon 6.5.5 fails
From: Kai Hackemesser <kaha@xxxxxx>
Date: Wed, 16 May 2007 10:56:57 +0200
Michael Kay schrieb:
I have a (currently) simple java method I want to use in a xsl stylesheet. I use XSL 1.0 and Saxon 6.5.5 (project requirement :'( ).

Please tell whoever it is that sets your project requirements that Saxon
6.5.5 is getting rather old, that its developer no longer remembers very
much about how it works, and that Saxon 8.9.0.3 handles XSLT 1.0 stylesheets
just as well if not better, unless you use one of the very few pathological
constructs where the specification changes incompatibly in XSLT 2.0.
The requirements are: It has to run with pure JDK 1.4.2 and there it is used, isn't it?
In meantime somehow I gut success avoiding this error message, don't ask, how. (Trying this and that ...)
Now I get a new problem: My java method should return a NodeList or something like that. I haven't found the Node implementation class to avoid that error:


Supplied NodeList contains non-Saxon DOM Nodes

The return values represents a String array or something alike.

Do you have a tip?

Ciao!
Kai

However, I've opened up the source code for the first time in many months,
to see what exactly the message means. As far as I can see, you can only get
this message if the supplied type of one of the arguments to the extension
function is an XPath string, and the declared type of the parameter in the
Java method is org.w3.dom.NodeList.

Is it possible that it's trying to call a different version of your method?
It looks to me as if the version you've shown us is essentially a diagnostic
method that's simply there to display the types of the arguments it has been
given. This isn't actually a very effective diagnostic in the first place,
because the conversions that Saxon performs will depend on the declared
types of the parameters to the method. My theory is that you had a different
version of the method before you wrote the diagnostic version, and it's that
that's being called.

Michael Kay
http://www.saxonica.com/

Current Thread