title: How to pass XSL variable in to a Javascript function?
body: <p>Below is my sample XSL file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"&gt;
      &lt;xsl:template match="/"&gt;
          &lt;html&gt;
              &lt;head&gt;
                  &lt;script type="text/javascript"&gt;
                  //&lt;![CDATA[
                  function showHide(elementid){
                      if (document.getElementById(elementid).style.display == 'none'){
                          document.getElementById(elementid).style.display = '';
                      } else {
                          document.getElementById(elementid).style.display = 'none';
                      }
                  }
                  //]]&gt;&lt;/script&gt;
                  &lt;!-- Inserting pie chart  --&gt;
                  &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
                  &lt;script type="text/javascript"&gt;
                  //&lt;![CDATA[
                  google.load("visualization", "1", {packages:["corechart"]});
                  google.setOnLoadCallback(drawChart);
                  function drawChart() {
                      var data = google.visualization.arrayToDataTable([
                          ['Task', 'Hours per Day'],
                          ['Work',     11],
                          ['Eat',      2],
                          ['Commute',  2],
                          ['Watch TV', 2],
                          ['Sleep',    7]
                      ]);
  
                      var options = {
                          title: 'My Daily Activities'
                      };
  
                      var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
                      chart.draw(data, options);
                  }
              //]]&gt;&lt;/script&gt;
              &lt;!--Finishing pie chRt --&gt;
              &lt;/head&gt;
              &lt;body&gt;
                  &lt;h2&gt;eBuilder Automation Test Suite-Summary&lt;/h2&gt;
                  &lt;div id="chart_div" style="width: 600px; height: 400px;"&gt;&lt;/div&gt;
                  &lt;table border="1"&gt;
                      &lt;tr bgcolor="#808080"&gt;
                          &lt;th&gt;Name&lt;/th&gt;
                          &lt;th&gt;Total TCS&lt;/th&gt;
                          &lt;th&gt;Passed&lt;/th&gt;
                          &lt;th&gt;Skipped&lt;/th&gt;
                          &lt;th&gt;Errors&lt;/th&gt;
                          &lt;th&gt;Failures&lt;/th&gt;
                          &lt;th&gt;Pass Rate&lt;/th&gt;
                          &lt;th&gt;Tot Time Taken&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;xsl:for-each select="testsuite"&gt;
                          &lt;xsl:variable name="PassCount"&gt;
                              &lt;number&gt;
                                  &lt;xsl:value-of select="(@tests - @skipped - @errors - @failures)"/&gt;
                              &lt;/number&gt;
                          &lt;/xsl:variable&gt;
                          &lt;tr&gt;
                              &lt;td&gt;
                                  &lt;xsl:value-of select="@name"/&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;xsl:value-of select="@tests"/&gt;
                              &lt;/td&gt;
  
                              &lt;td bgcolor="#32CD32"&gt;
                                  &lt;xsl:value-of select="(@tests - @skipped - @errors - @failures)"/&gt;
                              &lt;/td&gt;
                              &lt;td bgcolor="#FFFF00"&gt;
                                  &lt;xsl:value-of select="@skipped"/&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;xsl:value-of select="@errors"/&gt;
                              &lt;/td&gt;
                              &lt;td bgcolor="#FF0000"&gt;
                                  &lt;xsl:value-of select="@failures"/&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;font color="red"&gt;
                                      &lt;xsl:value-of select="(msxsl:node-set($PassCount)/number) div @tests * 100"/&gt;%
                                  &lt;/font&gt; 
                              &lt;/td&gt;
                              &lt;td bgcolor="#008000"&gt;
                                  &lt;xsl:value-of select="@time"/&gt;
                              &lt;/td&gt;
                              &lt;!--xsl:value-of select="@failures div @tests *100"/--&gt;
                          &lt;/tr&gt;
                      &lt;/xsl:for-each&gt;
                  &lt;/table&gt;
              &lt;/body&gt;
          &lt;/html&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I want to pass the XSL variable <code>PassCount</code> like that below:</p>
  
  <pre><code>var data = google.visualization.arrayToDataTable([
            ['Task', 'Hours per Day'],
            ['Work',     passcount],
            ['Eat',      2],
            ['Commute',  2],
            ['Watch TV', 2],
            ['Sleep',    7]
          ]);
  </code></pre>
  
  <p>Is there any smart way to do this?</p>