XSLT Nested For-Each Loop

Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 1
Reputation: dghosh is an unknown quantity at this point 
Solved Threads: 0
dghosh dghosh is offline Offline
Newbie Poster

XSLT Nested For-Each Loop

 
0
  #1
Jul 2nd, 2008
I need to work with a nested for-each loop in XSLT. Below is the code. Please note that I am using grouping here.

<xsl:key name="list" match="video_card" use="id"/>

<xsl:for-each select="(//video_card)[generate-id(.)=generate-id(key('list', id))]/id">

<div class="show_config_list">
   <xsl:for-each select="key('list', .)">
      <xsl:sort select="config_name"/>
      <input type="checkbox" class="config_list" value="{config_id}" name="cfg[][id]" id="cfg_{position()}" checked="checked" />
   </xsl:for-each>
</div>

If you notice, the ID keeps repeating for different groups of video cards. In other words, for every group of video cards, the ID would start at cfg_1 followed by cfg_2, cfg_3...

This is undesirable. I need it to be cfg_1 to cfg_n where n='no. of configs'.

Is there a way of doing this?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the XML, XSLT and XPATH Forum
Thread Tools Search this Thread



Tag cloud for XML, XSLT and XPATH
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC