Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT calling Java methods

 
Payam Fard
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic