How to set element value dynamically based on for each loop count

Posted by user1515918 on Stack Overflow See other posts from Stack Overflow or by user1515918
Published on 2012-07-10T20:26:13Z Indexed on 2012/07/11 3:16 UTC
Read the original article Hit count: 179

Filed under:
|
|

Here is snippet of an xsl file that I am trying to make work.

I would like to change value for element request-tot-queries in the header based on loop count in the Body. Your help would be greatly appreciated!

<HEADER>
  <request-tot-queries>$Counter</request-tot-queries>
</HEADER>
<Body>
 <xsl:for-each select="//Request/Responses/Pooled/ResidenceHistory/Residencies/Residency">
 <count><xsl:variable name="counter" select="position()"/></count>
  <xsl:if test="DateRange/To/Date[@Type!='Present']">
   <subject-query>
      .
      .
      .
   </subject-query>
  </xsl:if>
 </xsl:for-each>
</Body>

© Stack Overflow or respective owner

Related posts about xslt

Related posts about foreach