Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript in XSL

 
Janaki Samaraweera
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to xml and xsl .
the requirement of our project is we have a xml document and corresponding
xsl style sheet.
once we create a HTML using the xml and xsl, how can we trap events based on
controls created.
i.e if we have a list box created in the final HTML, how can i trap the on
change event of the list box
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to get a working version of HTML with all supporting JavaScript. Then you code JavaScript in XSL. The only tricky part is that "<" symbol cannot be used in XSL as is, it must be "escaped", and to avoid such a hassle people wrap scripts in CDATA sections.
So your XSL will look like
<?xml version='1.0'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<html>
...
<script language="JavaScript">
<![CDATA[
function someFunction()
{ ... }
]]>
</script>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic