title: Assigning value to variable in XSLT
body: <p>I am working on an XSLT where there are two <strong>foreach blocks</strong>. say <strong>Block1</strong> and <strong>Block2</strong></p>
  
  <p>Based on the elements in for loop in Block1, I will be generating a variable which will be used in Block2.</p>
  
  <p>The problem is with asigning value to variable in first block</p>
  
  <p><strong>Case-1</strong> <strong>I define variable inside Block 1</strong>, say var</p>
  
  <ul>
  <li>In this case I cannot reference variable var in second Block(i.e Block2), in gives me <strong>variable out-of-scope error</strong>.</li>
  </ul>
  
  <p><strong>Case-2</strong> <strong>I define variable outside both Blocks,</strong> say as a global variable.</p>
  
  <ul>
  <li>In this case I can refrence the variable <strong>BUT</strong> the change made to variable in Block1 is not reflected in Block2.</li>
  </ul>