[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Where do I put <xsl:script>
Where do I put the <xsl:script> command? I was trying: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="view-source"/> <xsl:script language="javascript" function showdate() { var d = new date() return (d); } </xsl:script> <!-- some code --> <xsl:eval>showdate()</xsl:eval> But I kept on getting the following error from Cocoon (javax.xml.transform.TransformerException: xsl:script is not allowed in this position in the stylesheet!). I checked Yahoo for sites containing <xsl:script> but they were referring to MSXML, something I am not using. However, I did locate a petition to remove <xsl:script> from XSL 1.1 (http://lists.xml.org/archives/xml-dev/200103/msg00043.html) but when I checked out the specs (http://www.w3.org/TR/xslt11/), the command is still there. From the specs, I gather that the <xsl:script> should be near the top of the XSL command. Originally, I tried putting the <xsl:script> inside my document, where I actually want the display to go. What is the proper format for embedding javascript and where should I put it to avoid the "not allowed in this position" error? I also tried putting the command before the <xsl:stylesheet.. command and of course that did not work. >From the URL (http://www.hypermedic.com/style/xsl/xsl_tut2.txt), I tried using <define-script> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="view-source"/> <xsl> <define-script> <![CDATA[ function showdate() { var d = new date() return (d); } ]]> </define-script> </xsl> <!-- some code --> <xsl:eval>showdate()</xsl:eval> 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
|