title: XSL : How to pass variable to for each
body: <pre><code>&lt;xsl:for-each select="$script/startWith"&gt;
    &lt;xsl:variable name = "i" &gt; 
      &lt;xsl:value-of select="$script/startWith[position()]"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:for-each select="JeuxDeMots/Element"&gt;
      &lt;xsl:variable name = "A" &gt; 
        &lt;xsl:value-of select="eName"/&gt;
      &lt;/xsl:variable&gt; 
      &lt;xsl:if test="starts-with($A,$i)= true()"&gt;
        &lt;xsl:variable name="stringReplace"&gt;
          &lt;xsl:value-of select="substring($i,0,3)"/&gt;
        &lt;/xsl:variable&gt;
        &lt;xsl:value-of select="$stringReplace"/&gt;
      &lt;/xsl:if&gt;
    &lt;/xsl:for-each&gt;   
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>Problem :  variable $i, can not pass in an xsl for-each.
  Please help me.</p>