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>

===================
owonseedAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
Hi owonseed,

As far as I know you can't.
Unless this has recently changed, you can't use JavaScript for extensions in Saxon.
You can only use Java for that

If I am correct only Xalan and MSXML support javascript for extensions.

I recommend you ask Michael Kay directly.
He is on the biglist

Cheers!
0
 
Geert BormansInformation ArchitectCommented:
owonseed,

a reference would have been nice, no?

http://lists.mulberrytech.com/xsl-list/archives/
0
 
owonseedAuthor Commented:
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
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Geert BormansInformation ArchitectCommented:
keep us posted here please
cheers
0
 
owonseedAuthor Commented:
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
0
 
Geert BormansInformation ArchitectCommented:
mmh, that is what I thought.
Thanks for sharing the answer with us
cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.