JavaScript Call in stylesheet and Saxon
Added by Anonymous about 17 years ago
Legacy ID: #4379798 Legacy Poster: Serge Emmanuel (spagop)
Hello all Saxon Gurus, I am making some performance enhancemnt in some stylesheets written for XALAN Processor. The deal is to change XALAN with SAXON and to see how fast saxon can be in comparison to xalan. Now this the situation, I figure out that some stylesheets have javascript extension (xmlns:js="http://www.mozila.org/rhino", ...) and then call javascript method through this extension. the question now is, how can change the javascript namespace so that I can use it with SAXON or what is the best practices to solve this problem without grandiose change in may stylesheet. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:js="http://www.mozila.org/rhino" xmlns:math="http://exslt.org/math" ... extension-element-prefixes="js" version="1.0" exclude-result-prefixes="" > <!-- ******************************************* --> <!-- JavaScript functions --> <lxslt:component prefix="js" elements="" functions="" > <lxslt:script lang="javascript" src="JavaScriptCode.js" /> </lxslt:component> <!-- Lookup a db param and make it to the output --> <xsl:template name="someParam"> <xsl:param name="PName" /> <!-- lookup that parameter --> <xsl:variable name="PNode" select="@*[local-name()=$PName]" /> <!-- parameter is present --> <xsl:if test="boolean($PNode)" > <!-- set the db field in the appropriate global variable --> <xsl:variable name="tmp" select="js:setFunctions(local-name(),$PName,string($PNode))" /> </xsl:if> ..... </xsl:template> <xsl:stylesheet/> Thanks for advance.
Replies (1)
RE: JavaScript Call in stylesheet and Saxon
-
Added by Anonymous about 17 years ago
Legacy ID: #4379823 Legacy Poster: Michael Kay (mhkay)
Saxon doesn't have any direct capability to call out to Javascript. You've got a number of options (a) rewrite the Javascript in XSLT (often possible given XSLT 2.0's extra power) (b) rewrite the Javascript in Java (c) call the Javascript via a Java wrapper. Michael Kay http://www.saxonica.com/
Please register to reply