[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Where do I put <xsl:script>

Subject: Where do I put <xsl:script>
From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx>
Date: Wed, 8 Aug 2001 08:35:52 -0400
define script xsl
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.