[Last Call] Learn how to a build a cloud-first strategyRegister Now


Using Javascript in Saxon

Posted on 2006-04-04
Medium Priority
Last Modified: 2013-11-18

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="com.ibm.bsf.engines.javascript.JavaScriptEngine">
   function greetings(user)
      return "Welcome to xxx " + user;

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


Question by:owonseed
  • 4
  • 2
LVL 60

Accepted Solution

Geert Bormans earned 750 total points
ID: 16373816
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

LVL 60

Expert Comment

by:Geert Bormans
ID: 16373833

a reference would have been nice, no?


Author Comment

ID: 16376107

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.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 60

Expert Comment

by:Geert Bormans
ID: 16376456
keep us posted here please

Author Comment

ID: 16376488
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.


LVL 60

Expert Comment

by:Geert Bormans
ID: 16378499
mmh, that is what I thought.
Thanks for sharing the answer with us

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question