Calling Javascript from XSL file
<p>I have a XML file........</p>

<pre><code>&lt;ROOT&gt;
      &lt;MYNODES&gt;
           &lt;MYNODE&gt;A&lt;/MYNODE&gt;
           &lt;MYNODE&gt;B&lt;/MYNODE&gt;
           &lt;MYNODE&gt;C&lt;/MYNODE&gt;
           &lt;MYNODE&gt;D&lt;/MYNODE&gt;
      &lt;/MYNODES&gt; 
      &lt;DOCS&gt;
           &lt;DOC&gt;1&lt;/DOC&gt;
           &lt;DOC&gt;2&lt;/DOC&gt;
           &lt;DOC&gt;3&lt;/DOC&gt;
      &lt;/DOC&gt; 
      &lt;PICS&gt;
           &lt;PIC&gt;a.jpeg&lt;/PIC&gt;
           &lt;PIC&gt;b.jpeg&lt;/PIC&gt;
           &lt;PIC&gt;c.jpeg&lt;/PIC&gt;
           &lt;PIC&gt;d.jpeg&lt;/PIC&gt;
           &lt;PIC&gt;e.jpeg&lt;/PIC&gt;
          &lt;/PICS&gt;
  &lt;/ROOT&gt;
</code></pre>

<p>and following XSLT file.....</p>

<pre><code>&lt;?xml version="1.0"?&gt;

&lt;xsl:stylesheet xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"&gt;

&lt;xsl:output method="xml" version="1.0" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/&gt;

&lt;xsl:template match="/ROOT"&gt;
    &lt;html lang="en" xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;
         &lt;title&gt;JINI  &lt;xsl:value-of select="/ROOT/MYNODES/MYNODE/." /&gt; &lt;/title&gt;
     &lt;link rel="stylesheet" type="text/css" href="jini.css" /&gt;
     &lt;script language="JavaScript" src="commonHead.js" type="text/javascript" /&gt;
        &lt;/head&gt;
    &lt;body&gt;

&lt;table style="font-size:11px" border="5" bgcolor="#FFFFFF" width="99%" align="center" cellpadding="5"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;xsl:attribute  name="bgcolor"&gt; #FFAAAA &lt;/xsl:attribute&gt; &lt;xsl:attribute  name="onMouseover" &gt;displayColor(event, 'blue') &lt;/xsl:attribute&gt; &lt;xsl:attribute  name="onMouseout"&gt; backToOriginal(event, 'yellow') &lt;/xsl:attribute&gt; AA&lt;/td&gt;
&lt;td&gt;BB &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/xsl:stylesheet&gt;
</code></pre>

<p>But my displayColor doesn't work in browser ...
Any clue.... How to call external function of java script file in XSL file...</p>

<p>My Javascript file is</p>

<pre><code>   /***********************************************
   * Highlight Table Cells Script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
   * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
   * This notice must stay intact for legal use
   ***********************************************/

   // Specify the default location for flying widget
   var xpos = -10;
   var ypos = 20;

   //Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
   var highlightbehavior="TD"

   var ns6=document.getElementById&amp;&amp;!document.all
   var ie=document.all

   function displayColor(event, color){
     /* Popup is integrated within changeto */
     changeto(event, color,0,"");
   }

   function displayColorAndInfos(event, color, line){
     /* Popup is integrated within changeto */
     changeto(event, color,1,line);
   }

   function backToOriginal(event, color) {
     /* Killlink is integrated within changeback */
     changeback(event, color);
   }

   function changeto(e,highlightcolor,flag,line){
   source=ie? event.srcElement : e.target
   if (source.tagName=="TABLE")
   return
   while(source.tagName!=highlightbehavior &amp;&amp; source.tagName!="HTML")
   source=ns6? source.parentNode : source.parentElement
   if (source.style.backgroundColor!=highlightcolor&amp;&amp;source.id!="ignore"){
      source.style.backgroundColor=highlightcolor
      if (flag==1) {
    poplink(line,-500,5);
    }
      }
   }

   function contains_ns6(master, slave) { //check if slave is contained by master
   while (slave.parentNode)
   if ((slave = slave.parentNode) == master)
   return true;
   return false;
   }

   function changeback(e,originalcolor){
   if (ie&amp;&amp;(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
   return
   else if (ns6&amp;&amp;(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
   return
   if (ie&amp;&amp;event.toElement!=source||ns6&amp;&amp;e.relatedTarget!=source) {
      source.style.backgroundColor=originalcolor
      killlink();
      }
   }
</code></pre>
