Using Script Extensions in Xalan-Java - Running the Stylesheet
(Page 8 of 8 )
The complete stylesheet is available here. The stylesheet contains all four script language implementations and is configured to run the JavaScript functions. To select a different script implementation, set the appropriate variable to 1 in the stylesheet section shown below, and reset all the other use-script variables to 0. The variable settings below will use VBScript function implementations.
<!-- SWITCH ON/OFF SCRIPT LANGUAGES HERE -->
<xsl:variable name="use-javascript" select="0"/>
<xsl:variable name="use-jpython" select="0"/>
<xsl:variable name="use-vbscript" select="1"/>
<xsl:variable name="use-perlscript" select="0"/>
Ant Configuration
The samples are run using the build.xml Ant script. This script uses properties specified in the build.properties file. Ensure that the properties in this file are set correctly for your environment.
#product homes
xalan.home =d:/apps/xalan-j_2_6_0
js.home =d:/apps/rhino1_5R4
jython.home =d:/apps/jython-2.1
When the properties are correctly set, run the XSLT execute:
ant run
The run target will patch the BSF JAR file if required, build the Java Lookup class used in the scripts as necessary, and then call the Xalan command line tool, which transforms the input file ./xml/ sample_in.xml into ./xml/out.xml using the XSLT file ./xml/ sample_rules.xslt.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |