Recipe14.7.Scripting Extension Function Using Inline Script Code


Recipe 14.7. Scripting Extension Function Using Inline Script Code

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xslt" xmlns:trig="http://www.acmeX.com/extend/trig">    <xalan:component prefix="trig" functions="sin cons tan atan">   <xalan:script lang="javascript">     function sin (arg){ return Math.sin(arg);}      function cos (arg){ return Math.cos(arg);}      function tan (arg){ return Math.tan(arg);}      function atan (arg){ return Math.atan(arg);}    </xalan:script> </xalan:component>     <xsl:variable name="pi" select="4.0 * trig:atan(1.0)"/>     <!-- ... -->     </xsl:stylesheet>

Saxon currently supports JavaScript, NetRexx, BML, JPython, Jacl, JScript, VBScript, and PerlScript, but appropriate extensions need to be obtained from third parties supporting the respective languages. See http://xml.apache.org/xalan-j/extensions.html#supported-lang for details.




XSLT Cookbook
XSLT Cookbook: Solutions and Examples for XML and XSLT Developers, 2nd Edition
ISBN: 0596009747
EAN: 2147483647
Year: 2003
Pages: 208
Authors: Sal Mangano

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net