This article will look at scripting languages that are not covered in the Xalan documentation, in particular, Python, VBScript, and PerlScript. In addition, we will show how Java Object instances, created in XSLT as part of the Java language extensions mechanism, are passed to these scripts and utilized by them. These samples will provide a solid foundation on which to build more complicated script-based extensions.
Using Script Extensions in Xalan-Java - Xalan-Java Scripting Extensions, Resources, Requirements (Page 2 of 8 )
Xalan-Java (Xalan-J) supports extension elements and functions written in scripting languages supported by the Bean Scripting Framework (BSF). A complete explanation of this support is available in the Xalan-Java documentation at http://xml.apache.org/xalan-j/extensions.html.
This article looks only at function extensions, that is, calling script functions from XSLT. We will look at scripting languages that are not covered in the Xalan documentation, in particular, Python, VBScript, and PerlScript. In addition, we will show how Java Object instances, created in XSLT as part of the Java language extensions mechanism, are passed to these scripts and utilized by them. These samples will provide a solid foundation on which to build more complicated script-based extensions.
Resources Provided with this Article
The resources listed in the following table are provided with this article:
Ant build script used to build and run the sample XSLT script.
Properties used by the Ant script.
The data used by the Java lookup bean used in the XSLT script.
Sample input XML file.
Input XML document schema.
Output document schema.
The XSLT stylesheet used in this article.
The LookupTable Bean class used in the stylesheet.
The patched BSF Java code required to support ActiveScripts.
Software Requirements to Run the Example Provided with this Article
The required JAR files must be in the classpath used by the Xalan processor. The active script DLL libraries directory must be added to the PATH environment variable. The directory containing the DLL may also be specified as a property passed to the JVM java.library.path property, for example:
java -Djava.library.path=D:/apps/bsf-2_2/lib/win32 etc.