title: xsl:variable as xpath value for other xsl tag
body: <p>I'm having issues with <code>xsl:variable</code>. I want to create a variable with a value that depends on the value of another XML node attribute. This working good. But when I try to create a variable with a string value that represents XPath, it just doesn't work when I try to use it as XPath in a later XSL tag. </p>
  
  <pre><code>&lt;xsl:variable name="test"&gt;  
    &lt;xsl:choose&gt;
      &lt;xsl:when test="node/@attribute=0"&gt;string/represent/xpath/1&lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;string/represent/xpath/2&lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;       
  &lt;/xsl:variable&gt;                 
  &lt;xsl:for-each select="$test"&gt;
    [...]
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>I tried:
   <a href="https://stackoverflow.com/questions/4032400/how-to-use-xsl-variable-in-xsl-if">How to use xsl variable in xsl if</a>
  and
   <a href="https://stackoverflow.com/questions/1971420/trouble-with-xslfor-each-selection-using-xslvariable">trouble with xsl:for-each selection using xsl:variable</a>. But with no results.</p>