Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript in xsl template

Status
Not open for further replies.

herisud

Programmer
Aug 20, 2005
3
0
0
CA
I want to use a javascript function within an xsl template that generates a zebra table (with color-alternating columns).

The function would be called in an html file from the 'onload' property of the body element. How can I embed this call (and the js function) in the template so that it is visible to a browser viewing an xml file that references this template?

Thanks in advance!!
 
Rather than fighting all the issues of embedded JavaScript, it is easier to place the JavaScript in a separate file and use something like this:
Code:
  <script type="text/javascript" src="js/mycode.js">//</script>
The (null) JS comment between the script tags keeps XSLT from turning the <script ...></script> pair into <script .../>, which some browsers don't parse correctly.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top