You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Rajkumar, Joseph" <ra...@orionsci.com> on 2001/02/09 23:28:21 UTC
Extension functions in Java
Hi Folks
I am xalan_1_2_D02.jar which comes with Cocoon-1.8.2. I able to
make calls to java from my xsl file, after going though the
documentation
for external functions on the xalan site.
Within a template I am able call 'java.lang.string.new("myname")'
and
then call the toUpperCase() method using the instance variable that I
get
from the earlier call. This works just fine.
But my issue is, I want to have the class instance as a global
variable
initialised while processing the root node and then while processing
some
other nodes, I want to call methods on that instance.
I have been able to call new on a class in the root node and then
when
I try to call methods on that instance while processing some other
template,
I get the message:
Call to extension function failed: method call/new failed:
java.lang.NoSuchMethodException:
org.apache.xalan.xlst.ResultTreeFrag.isLoaded(class java.lang.Double) --
no signature match.
Even though I initialise a call called "Citations" and try to call
methods on that instance,
why does it complain about missing method isLoaded in ResultTreeFrag.
I have been able to get the whole this working properly by having a
single static method
in the class and then processing the returned string in xslt, but I
don't like using static
methods and would prefer method calls on instances.
Any help would be greatly appreciated.
Regards
Joseph Rajkumar
PS: I am not subscribed to this list, so a personal email would be
great.
Thanks email address mailto:rajkumar@orionsci.com
Re: Extension functions in Java
Posted by Gary L Peskin <ga...@firstech.com>.
Please give this a try with XalanJ 2.0.0. I think it will solve your
problems. If things still aren't working, please send the XML, XSLT,
and Java extension code that you are working with and we'll give it a
shot.
Gary
"Rajkumar, Joseph" wrote:
>
> Hi Folks
>
> I am xalan_1_2_D02.jar which comes with Cocoon-1.8.2. I able to
> make calls to java from my xsl file, after going though the
> documentation
> for external functions on the xalan site.
>
> Within a template I am able call 'java.lang.string.new("myname")'
> and
> then call the toUpperCase() method using the instance variable that I
> get
> from the earlier call. This works just fine.
>
> But my issue is, I want to have the class instance as a global
> variable
> initialised while processing the root node and then while processing
> some
> other nodes, I want to call methods on that instance.
>
> I have been able to call new on a class in the root node and then
> when
> I try to call methods on that instance while processing some other
> template,
> I get the message:
> Call to extension function failed: method call/new failed:
> java.lang.NoSuchMethodException:
> org.apache.xalan.xlst.ResultTreeFrag.isLoaded(class java.lang.Double) --
> no signature match.
>
> Even though I initialise a call called "Citations" and try to call
> methods on that instance,
> why does it complain about missing method isLoaded in ResultTreeFrag.
>
> I have been able to get the whole this working properly by having a
> single static method
> in the class and then processing the returned string in xslt, but I
> don't like using static
> methods and would prefer method calls on instances.
>
> Any help would be greatly appreciated.
> Regards
> Joseph Rajkumar
>
> PS: I am not subscribed to this list, so a personal email would be
> great.
> Thanks email address mailto:rajkumar@orionsci.com
--
Gary L Peskin
The Firstech Corporation
+1.323.658.1146
http://www.simdate.com