Link to home
Start Free TrialLog in
Avatar of owonseed
owonseed

asked on

Using Javascript in Saxon

Hi,

I'm trying to get the Saxon to use javascript in the XSL. I know this can be achieved in Xalan but I'm having difficulty to get it to work in Saxon. Does it requies BSF and Rhino setup on my local? I have them in my classpath but it is still not working. The following is the code I use. Have anybody done this before? Really appreciate for any suggestion. Thanks!

o.s

===================

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:saxon="http://icl.com/saxon"
      extension-element-prefixes="test saxon">

<saxon:script language="javascript" implements-prefix="test" src="com.ibm.bsf.engines.javascript.JavaScriptEngine">
   function greetings(user)
   {
      return "Welcome to xxx " + user;
   }
</saxon:script>

<xsl:template match="/">
   <xsl:value-of select="test:greetings('Mr. Bean')"/>
</xsl:template>

</xsl:stylesheet>

===================
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
owonseed,

a reference would have been nice, no?

http://lists.mulberrytech.com/xsl-list/archives/
Avatar of owonseed
owonseed

ASKER

Gertone,

Thanks for the tips. I've posted a new thread in the Saxon forum. I hope I can get a response from Michael Kay soon.

o.s
keep us posted here please
cheers
I got the response from Michael Kay:

Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3669255
By: mhkay

Javascript is not currently supported and I don't have any plans to do so. It could be done without changes to core Saxon code by writing a new ExtensionBinder, but I'm wary of doing things that involve potential dependencies and installation/configuration complications because they always generate a heavy support and testing load.

--

o.s
mmh, that is what I thought.
Thanks for sharing the answer with us
cheers