bonyka Posted October 4, 2007 Share Posted October 4, 2007 Hey, guys.I want to insert javascript function in my xsl file, but i cannot call it.It seem it doesn't work.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="xml" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/><title>test</title><script type="text/javascript"> function greeting() { document.write("hello, i'm bonyka,"); }</script></head><body><table> <tr> <td onclick="greeting()"> <xsl:value-of select="name" /> </td> </tr></table></body></html></xsl:template></xsl:stylesheet>------------------------------------------------thanks,bonyka Link to comment Share on other sites More sharing options...
boen_robot Posted October 4, 2007 Share Posted October 4, 2007 Apart from the wrong XML prolog (note the "!". It should be "?"), try to mark your script in CDATA like so: <script type="text/javascript"><![CDATA[function greeting(){document.write("hello, i'm bonyka,");}]]></script> Link to comment Share on other sites More sharing options...
bonyka Posted October 22, 2007 Author Share Posted October 22, 2007 Hi, guys.I solved that problem.Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.