Using Javascript in Saxon


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!



<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
      extension-element-prefixes="test saxon">

<saxon:script language="javascript" implements-prefix="test" src="">
   function greetings(user)
      return "Welcome to xxx " + user;

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


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information 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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gertone (Geert Bormans)Information ArchitectCommented:

a reference would have been nice, no?
owonseedAuthor Commented:

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.

Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Gertone (Geert Bormans)Information ArchitectCommented:
keep us posted here please
owonseedAuthor Commented:
I got the response from Michael Kay:

Read and respond to this message at:
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.


Gertone (Geert Bormans)Information ArchitectCommented:
mmh, that is what I thought.
Thanks for sharing the answer with us
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.