Subject: RE: [xsl] Calling a java method in XSL 1.0 with Saxon 6.5.5 fails From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 16 May 2007 09:01:04 +0100 |
> 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. 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/ > This is the class I want to call (the signature is not final, > just because I want it running at all now): > > public class LineSplitter { > > public static Object splitIntoLines(Object nodes, Object > lineLengths) { > return new String(nodes.getClass().getCanonicalName() + "\n" > + lineLengths.getClass().getCanonicalName()); > } > } > > > and this is the template I want to use it with: > > <xsl:template name="splitIntoRows"> > <xsl:param name="nodes"/> > <xsl:param name="linelengths"/> > <xsl:value-of select="splitter:splitIntoLines($nodes, > $linelengths)" > xmlns:splitter="java:xxx.xslextension.LineSplitter"/> > </xsl:template> > > > While debugging this method in Oxygen Eclipse Plugin I get > following error: > > Conversion of string to org.w3c.dom.NodeList is not supported > > I'm not converting anything as I think. What is going wrong here? > > Kind regards, > Kai
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Calling a java method in XSL , Kai Hackemesser | Thread | Re: [xsl] Calling a java method in , Kai Hackemesser |
[xsl] complicated sort problem, Vaduvoiu Tiberiu | Date | [xsl] EXE verson of Saxon, J. S. Rawat |
Month |