bonyka Posted October 4, 2007 Report 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 Report 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 Report Share Posted October 22, 2007 Hi, guys.I solved that problem.Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now