| | |
XSLT Nested For-Each Loop
Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 1
Reputation:
Solved Threads: 0
I need to work with a nested for-each loop in XSLT. Below is the code. Please note that I am using grouping here.
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?
<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?
![]() |
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: Rendering XML
- Next Thread: Writing XML parser - some syntax questions
| Thread Tools | Search this Thread |
Tag cloud for XML, XSLT and XPATH
api blogger blogging code delete development dynamiccreationofnvariablesinxslt error firstthreecharacterofastringrequired flipbook gdata google html include java link linspire linux microsoft news node openoffice overwrite precedence programming rss standards swf template transform variable w3c web xml xmlnotloading xmlonserver xsl xslt





