I want to initialize a variable inside one for-each block to capture the value stored in the last iteration and use it in the next for-each block with the last value.
<xsl:for-each select="tns:ClientContributionDetails">
<ns1:Line>
<ns1:LineNumber>
<xsl:value-of select="position()*2+1"/>
</ns1:LineNumber>
</ns1:Line>
<ns1:Line>
<ns1:LineNumber>
<xsl:value-of select="(position()+1)*2"/>
</ns1:LineNumber>
</ns1:Line>
</xsl:for-each>
<xsl:for-each select="tns:ThirdPartyContributionDetails">
<ns1:Line>
<ns1:LineNumber>
<!--I want here the loop begins with the value stored in the last iteration of the pervious for-each-->
</ns1:LineNumber>
</xsl:for-each>