wood burning stoves*
The moose likes XML and Related Technologies and the fly likes Java call backs in XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Java call backs in XSLT" Watch "Java call backs in XSLT" New topic
Author

Java call backs in XSLT

Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

Hi,

I have a java class which i am calling in XSLT using the java call back api's provided by XSLT.
I am able to pass a NodeList to the calling method as a param but when i return a Node from the method the XSLT engine renders the same as a string [actually the toString of the Node gets called and this gets rendered].

How do i return a Node from the method called from the XSLT. Any help in this regard would be greatly appreciated.


Devesh H Rao
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
XSLT isn't "procedural" like that -- so it doesn't and wouldn't "return" anything .... that's why you get the toString issue (unless you're doing it in XML-mode, in which case you actually see the full node structure printed out instead of the textual value of each node in the tree).


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Devesh H Rao
Ranch Hand

Joined: Feb 09, 2002
Posts: 687

Originally posted by Nathaniel Stoddard:
XSLT isn't "procedural" like that -- so it doesn't and wouldn't "return" anything .... that's why you get the toString issue (unless you're doing it in XML-mode, in which case you actually see the full node structure printed out instead of the textual value of each node in the tree).



so you mean to say there is no way the java method that i have called from a xslt function can return a node.

is there any other way i can get this done. ok i think i need to explain a bit more what i need to do before asking what i need

say for example i have 3 nodes
<X> <X>
<X> <X>
<X> <X>

I need to process these nodes and based on certain rules need to return a single node

<X> ? <X>

i am able to pass the NodeList to the java method called from XSLT and i do the processing also but when i return a node the toString of the Node is printed.
is there any way i can get the Processed Node returned from the java method call.

Note: The rules are very dynamic hence i cannot build them in XSLT i need to get this done in Java itself

Thanks
[ September 10, 2004: Message edited by: Devesh H Rao ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java call backs in XSLT
 
Similar Threads
How to call static methods from non static methods
AJAX Issue - Messages got lost...
Array clone
Local call involves pass-by-reference
Passing XML Fragment as NodeList To Java Class