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

Re: Passing XSL variable to Javascript!

Subject: Re: Passing XSL variable to Javascript!
From: "Syed Abuthaheer" <abuthaheer.syed@xxxxxxxxxxxxxxxx>
Date: Fri, 10 Aug 2001 09:28:42 +0800
xsl variable name javascript
thanks a lot. it's working fine.
regards,
syed.
----- Original Message -----
From: "Rosa I-Ting Cheng" <Rosa@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, August 10, 2001 9:19 AM
Subject: RE:  Passing XSL variable to Javascript!


> I haven't tested it, but try putting in braces {$temp} instead of just
> $temp.
>
> -----Original Message-----
> From: Syed Abuthaheer [mailto:abuthaheer.syed@xxxxxxxxxxxxxxxx]
> Sent: Friday, 10 August 2001 11:05 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Passing XSL variable to Javascript!
>
>
> Hi all,
> I am facing a problem when i am trying to pass a XSL variable to a
> javascript function. Herewith i am pasting test.htm, test.xml and test.xsl
> codes for ur reference. I am displaying the value of root/address/name
from
> test.xml as hyperlink using test.xsl. When i am clicking the hyperlink, i
am
> calling a javascript function callfun1(temp). I am passing the the
variable
> temp from XSL like (pl refer test.xml and test.xsl code below)
>
>     <xsl:for-each select="root/address">
>      <xsl:variable name="temp"><xsl:value-of
select="name"/></xsl:variable>
>      <a href="JavaScript:callfun1($temp)"><xsl:value-of
> select="name"/></a><br/>
>      </xsl:for-each>
>
> But the value of 'temp' is not passed. Instead '$temp' is passed as such.
> Can any one help me to solve this problem.
>
> HTML code:(test.htm)
> <html>
> <head>
>   <script language="javascript">
>  function callfun()
>  {
>   var xml = new ActiveXObject("Microsoft.XMLDOM")
>   xml.async = false
>   xml.load("test.xml")
>   var xsl = new ActiveXObject("Microsoft.XMLDOM")
>   xsl.async = false
>   xsl.load("test.xsl");
>   // Transform
>   document.write(xml.transformNode(xsl))
>  }
>  function callfun1(temp)
>  {
>   alert("temp:"+temp);
>  }
>   </script>
> </head>
> <body>
>   <input type="button" name="click" value="Click" onClick="callfun()">
> </body>
> </html>
>
> XML code:(test.xml)
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
>  <address>
>   <name>A</name>
>  </address>
>  <address>
>   <name>B</name>
>  </address>
>  <address>
>   <name>C</name>
>  </address>
> </root>
>
> XSL code:(test.xsl)
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version
=
> "1.0" >
>  <xsl:template match="/">
>   <html>
>    <body>
>     <xsl:for-each select="root/address">
>      <xsl:variable name="temp"><xsl:value-of
select="name"/></xsl:variable>
>      <a href="JavaScript:callfun1($temp)"><xsl:value-of
> select="name"/></a><br/>
>      </xsl:for-each>
>    </body>
>   </html>
>  </xsl:template>
> </xsl:stylesheet>
>
> Your assistance is highly appreciated.
> Thanks in advance.
> Regards,
> Syed.
>
>
>
>
>  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.