A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
XML and Related Technologies
XSLT calling Java methods
Joined: Jan 31, 2003
Oct 02, 2007 10:36:00
How can I make calls to
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.
Joined: Sep 27, 2007
Oct 02, 2007 14:01:00
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.
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="key">dd-mm-yyyy</xsl:param> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="someMatch"> <h1>The value of key is "<xsl:value-of select="$key"/>"</h1> <xsl:apply-templates/> </body> </html> </xsl:template>
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.
Joined: Nov 14, 2000
Oct 03, 2007 09:17:00
Hi, Payam Fard
Here are two examples I wrote several years ago. I think it will give you a head start.
If you meet any problems, please let me know.
I agree. Here's the link:
subject: XSLT calling Java methods
XMl to flatfile conversion
SOS configuring Xalan on NB
Split xml using xsl
Execting Java methods from XSLT
Installing XSLT processor
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014