jd.xml.xslt.extension
Class ScriptExtensionHandler

java.lang.Object
  extended byjd.xml.xslt.extension.ExtensionHandler
      extended byjd.xml.xslt.extension.ScriptExtensionHandler

public class ScriptExtensionHandler
extends ExtensionHandler

An ExtensionHandler that maps extension functions to functions of a scripting language like javascript or vbscript. It is defined by a script-element. For instance

      
      
      
          function helloWorld()
          {
              return "Hello World";
          }
      
      
 
 allows expressions to use the javascript functions:
 
      
 


Constructor Summary
ScriptExtensionHandler(String namespaceUri, String language)
          Create a ScriptExtensionHandler
 
Method Summary
 void addScript(String script)
          Add another script.
 Function getFunction(XsltContext context, String functionName, Expression[] arguments)
          Return a extension function for the given name.
 String getLanguage()
          Return the script language of this ExtensionHandler.
 boolean isElementAvailable(String name)
          Return if an extension element is available.
 boolean isFunctionAvailable(String name)
          Return if the associated java class has a method with the given name If true this does not guarantee that the method can be called successfully.
 
Methods inherited from class jd.xml.xslt.extension.ExtensionHandler
camelCaseName, implementsUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptExtensionHandler

public ScriptExtensionHandler(String namespaceUri,
                              String language)
Create a ScriptExtensionHandler

Parameters:
namespaceUri - the namespace uri of this ExtensionHandler
Method Detail

getLanguage

public String getLanguage()
Return the script language of this ExtensionHandler.


addScript

public void addScript(String script)
               throws BSFException
Add another script.

Throws:
BSFException

isElementAvailable

public boolean isElementAvailable(String name)
Return if an extension element is available.

Specified by:
isElementAvailable in class ExtensionHandler

getFunction

public Function getFunction(XsltContext context,
                            String functionName,
                            Expression[] arguments)
Return a extension function for the given name.

Specified by:
getFunction in class ExtensionHandler
Parameters:
arguments - the arguments passed to the method
functionName - the function name

isFunctionAvailable

public boolean isFunctionAvailable(String name)
Return if the associated java class has a method with the given name If true this does not guarantee that the method can be called successfully.

Specified by:
isFunctionAvailable in class ExtensionHandler
Parameters:
name - the method name. If it equals "new" it is tested whether the class has a constructor.