Subject: [xsl] Where do I put <xsl:script> From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx> Date: Wed, 8 Aug 2001 08:35:52 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: detecting attribute n, Dimitre Novatchev | Thread | Re: [xsl] Where do I put <xsl:scrip, Goetz Bock |
[xsl] Re: Re: detecting attribute n, Dimitre Novatchev | Date | Re: [xsl] Where do I put <xsl:scrip, Goetz Bock |
Month |