title: Use variable ouside of scope in xslt
body: <p>Here I have a small snippet which has a variable num_cpu under a if condition, i am not able to access it outside the if condition tag. How do i solve this?</p>
  
  <p>How do i make the num_cpu global so that i can use it multiple times outside the for loop?</p>
  
  <pre><code>    &lt;xsl:for-each select="t:container"&gt;
          &lt;xsl:if test="@name = 'cpu'"&gt;
              &lt;xsl:variable name="num_cpu" select="t:leaf/t:value/@value"/&gt;
         &lt;/xsl:if&gt;
         &lt;xsl:value-of select="$num_cpu"/&gt;
      &lt;/xsl:for-each&gt;
  </code></pre>