aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSLT calling Java methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT calling Java methods" Watch "XSLT calling Java methods" New topic
Author

XSLT calling Java methods

Payam Fard
Ranch Hand

Joined: Jan 31, 2003
Posts: 73
How can I make calls to Java inside my xslt code? I have the following needs:

1) Include Java Date
2) Pass some variable values to be included in the xml document that is generated by the xslt.

Any pointers would be helpful.

Thanks.
Craig Bayley
Ranch Hand

Joined: Sep 27, 2007
Posts: 46
Most transformers allow you to pass in parameters:



In the transform you initialise this parameter at the top of the stylesheet, and if you pass in a parameter it will be overriden with whatever you passed in.



In terms of calling java from within xslt...erm...Why, architecturally, would you want to be in that position? Can't help on that one, I'm afraid.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Hi, Payam Fard

Here are two examples I wrote several years ago. I think it will give you a head start.
http://bobcat.webappcabaret.net/javachina/faq/xslt_01.htm#xslt_ex_Q30

If you meet any problems, please let me know.

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT calling Java methods
 
Similar Threads
SOS configuring Xalan on NB
Installing XSLT processor
XMl to flatfile conversion
Execting Java methods from XSLT
Split xml using xsl