Using Javascript in Saxon

Posted on 2006-04-04
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="">
   function greetings(user)
      return "Welcome to xxx " + user;

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


Question by:owonseed
    LVL 60

    Accepted Solution

    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

    a reference would have been nice, no?

    Author Comment


    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.

    LVL 60

    Expert Comment

    by:Geert Bormans
    keep us posted here please

    Author Comment

    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
    mmh, that is what I thought.
    Thanks for sharing the answer with us

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    XSL Grouping 7 34
    Merge XML into DOM 5 25
    Contact Forms for Website 6 56
    Grunt No Clean Targets 6 20
    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    Shoutout to Emily Plummer ( 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…
    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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now