Subject: RE: [xsl] How do we call Javascript function in XSL file on Netsc ape(Ver 6.2) browser? From: "Deshpande, Gururaj" <gururaj.deshpande@xxxxxxxxxxxx> Date: Wed, 10 Apr 2002 13:46:23 -0400 |
Hi Charles, I am copying my XSL and XML files. Can you find out the problem? <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="equipment.xsl"?> <plant> <dept deptid="231"> <eqpt eqptid="39"> <equipmentno>010.AS100</equipmentno> <description>High-top airslide 300 12 200</description> <prodxml>prod39.xml</prodxml> </eqpt> <eqpt eqptid="38"> <equipmentno>010.AS200</equipmentno> <description>Low-bottom airslide 200 12 100</description> <prodxml>prod38.xml</prodxml> </eqpt> <eqpt eqptid="37"> <equipmentno>010.AS300</equipmentno> <description>No-bottom airslide 200 12 100</description> <prodxml>prod37.xml</prodxml> </eqpt> </dept> </plant> ------------------------------------------ <?xml version='1.0' encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <SCRIPT language="JavaScript"><![CDATA[ function test(avalue) { alert(avalue); } ]]></SCRIPT> </head> <body> <table border="1"> <tr> <td>Equipment No.</td> <td>Description</td> </tr> <xsl:apply-templates select="plant/dept/eqpt"/> </table> </body> </html> </xsl:template> <xsl:template match="plant/dept/eqpt"> <xsl:for-each select="."> <tr> <td><a href="javascript:test('{prodxml}')"><xsl:value-of select="equipmentno"/></a></td> <td><xsl:value-of select="description"/></td> </tr> </xsl:for-each> </xsl:template> </xsl:stylesheet> --------------------------------------------------------- > Hi Gururaj > > One thing, one of your table elements wasn't closed in your sample, but > also, the stuff in curly braces in your a href where your Javascript > function is being called is, I'm assuming, being interpreted as an > attribute > value template. I haven't tested your code, but that's probably it. > Anything > in an attribute value surrounded by {} gets interpeted as an AVT, in other > words, an expression. > > regards, > > Charles White > CEO > The Tumeric Partnership > http://www.tumeric.net > chuck@xxxxxxxxxxx > ________________________________________ > Author, Mastering XSLT > Sybex Books, May, 2002 > > Co-Author, Mastering XML, Premium Edition > Sybex Books, May, 2001 > http://www.javertising.com > > ----- Original Message ----- > From: "Deshpande, Gururaj" <gururaj.deshpande@xxxxxxxxxxxx> > To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx> > Sent: Wednesday, April 10, 2002 7:45 AM > Subject: [xsl] How do we call Javascript function in XSL file on Netscape > (Ver 6.2) browser? > > > > To, all XML Gurus > > My question is about Netscape 6.2, XSL, XML and Javascript. I am doing > > client side transformation. No server support at all. When I call > javascript > > function within XSL file, Netscape does not run / understand the > javascript. > > Same works on IE without problems. > > I am copying my XSL file below. > > Does anybody has a solution? Thanks > > Gururaj > > > > xsl file > > <?xml version='1.0' encoding="iso-8859-1"?> > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="html"/> > > <xsl:template match="/"> > > <html> > > <head> > > <title></title> > > </head> > > <link rel="stylesheet" type="text/css" > > href="../html/SparesCat.CSS"></link> > > <SCRIPT language="JavaScript"><![CDATA[ > > function test(avalue) { > > alert(avalue); > > } > > ]]></SCRIPT> > > <body> > > <table> > > <tr> > > <td>Equipment No..</td> > > <td>Description.</td> > > <td>Manufacture No..</td> > > <td>Contract No.</td> > > </tr> > > <xsl:apply-templates select="plant/dept/eqpt"/> > > </table > > > > </body> > > </html> > > </xsl:template> > > <xsl:template match="plant/dept/eqpt"> > > <xsl:for-each select="."> > > <tr valign="middle" class="TableGrey"> > > <td><a href="javascript:test('{prodxml}')"><xsl:value-of > > select="equipmentno"/></a></td> > > <td><xsl:value-of select="description"/></td> > > <td><xsl:value-of select="manufactureno"/></td> > > <td><xsl:value-of select="contractno"/></td> > > </tr> > > </xsl:for-each> > > </xsl:template> > > </xsl:stylesheet> > > > > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] applying templates to anc, Wendell Piez | Thread | Re: [xsl] How do we call Javascript, Joerg Heinicke |
Re: [xsl] How do we call Javascript, Chuck White | Date | [xsl] Re: Seperating a delimited St, Dimitre Novatchev |
Month |