[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Embedding javascript code into the XSL
David Carlisle wrote:
The normal extension language for the java XSLT engines is java rather than javascript (but you need to check the docs for each processor)
Here is an example on how to define and use JavaScript functios in Xalan: <?xml version='1.0' encoding='ISO-8859-1' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:counter="ext1" extension-element-prefixes="counter"> <lxslt:component prefix="counter" functions="count"> <lxslt:script lang="javascript"> var i = 1; function count() { i++; return i; } </lxslt:script> </lxslt:component> <xsl:template match="/"> <xsl:value-of select="counter:count()" /> <xsl:text>
</xsl:text> <xsl:value-of select="counter:count()" /> </xsl:template> </xsl:stylesheet> Note that you should really know what you are doing, your stylesheets will be non-protable and have a good chance to grow into a maintenance nightmare. J.Pietschmann XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|