title: How to match javascript variable within an XSL loop up and display matched record
body: <p>Here's my XSL</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt; 
  &lt;document&gt;
   &lt;metadata&gt;
    &lt;field name="MyWebsite/Metadata/Keywords"&gt;key1&lt;/field&gt;
    &lt;field name="MyWebsite/Metadata/active_url"&gt;link111&lt;/field&gt; 
   &lt;/metadata&gt; 
   &lt;metadata&gt; 
    &lt;field name="MyWebsite/Metadata/Keywords"&gt;key2&lt;/field&gt; 
    &lt;field name="MyWebsite/Metadata/active_url"&gt;link222&lt;/field&gt; 
   &lt;/metadata&gt; 
   &lt;metadata&gt; 
    &lt;field name="MyWebsite/Metadata/Keywords"&gt;key3&lt;/field&gt;
    &lt;field name="MyWebsite/Metadata/active_url"&gt;link333&lt;/field&gt; 
   &lt;/metadata&gt; 
  &lt;/document&gt;
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:template match="/"&gt; 
  &lt;script type="text/javascript"&gt;
  &lt;xsl:text disable-output-escaping="yes" &gt;
  &lt;![CDATA[
  var pass_js_variable = "key2";
  ]]&gt;
  &lt;/xsl:text&gt;
  &lt;/script&gt;
  
  Match Keywords:
  &lt;xsl:for-each select="document/metadata[field[@name = 'MyWebsite/Metadata/Keywords' and contains(.,$pass_js_variable)]]"&gt;
      Page URL: &lt;xsl:value-of select="field[@name = 'MyWebsite/Metadata/active_url']"/&gt;
  &lt;/xsl:for-each&gt; 
    &lt;/xsl:template&gt; 
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Results:
  If <strong>$pass_js_variable</strong> matches any of "<strong>field name="MyWebsite/Metadata/Keywords</strong>", then display active_url from xml.</p>
  
  <p>... but my code is not working... any idea?</p>