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

RE: complex javascript in xsl

Subject: RE: complex javascript in xsl
From: "Sandy Stasko" <sstasko@xxxxxxxxxxxxxx>
Date: Mon, 15 Jan 2001 09:30:17 -0500
complex javascript
this was very helpful, THANKS!  in script onload, i recursed my nodes
calling a js function to cache the image.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of cutlass
Sent: Sunday, January 14, 2001 4:27 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  complex javascript in xsl



u have to wrap javascript with something like

<script>
<xsl:text disable-output-escaping="yes"><![CDATA[
<!--
some javascript here
//-->
]]></xsl:text>
</script>

but if u want to recurse, generating some javascript with xsl, do
something like below using  <xsl:for-each>, there are better ways but
this will get  u started.


xsl
---------------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<HTML>

<script language="JavaScript1.1">
var photos=new Array()

<xsl:for-each select="//product">
photos3[0]='<xsl:value-of select="@image1"/>'
</xsl:for-each>

</script>


<BODY>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------------------------


xml
--------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<resource>
<product prodID='1' image1='somepicture01.jpg'/>
<product prodID='2' image1='somepicture02.jpg'/>
<product prodID='3' image1='somepicture03.jpg'/>
</resource>
---------------------------------------------------------------------


,jim fuller


Sandy Stasko wrote:

> i am trying to export javascript and html in my xsl.
> one thing i cannot get to work is exporting javascript functions that also
> make use of the xml nodes.
> for example, i want to be able to cache an array of images.  i want to use
> the javascript features of New Array and New Image, but point the src of
the
> image to a path in a node in my xml file.
>
> i cannot seem to use both javascript functions and xsl functions together.
> I have been able to put the script in an <xsl:script> tag and have full
use
> of the xml structure, but not the javascript features (Array, Image,
> document).  If i put the function in an html <script> tag, i have the
> opposite, it lets me access the javascript document and Image, but not my
> xml nodes.
>
> How can I do BOTH?
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.