troubleshooting Question

XSL Loop inside a loop

Avatar of itcouple
itcoupleFlag for United Kingdom of Great Britain and Northern Ireland asked on
XMLMicrosoft SQL Server 2008
14 Comments1 Solution287 ViewsLast Modified:

I have generated an XML file using SSRS (see attached)

I'm trying to get loop inside loop so (see code below)
<xsl:for-each select="//*[local-name()='ResultCategoryNode']">
					<xsl:attribute name="Name">
						<xsl:value-of select="@ResultFieldCategory"/>
						<xsl:for-each select="(//*[local-name()='ResultCategoryNode'])[@ResultFieldCategory=??ValuesFromOuterLoop??]">
							<xsl:attribute name="name">
								<xsl:value-of select="@ReportFieldMonth"/>
							<xsl:attribute name="value">
								<xsl:value-of select="@ReportFieldValue"/>
which is incomplete and not working .

I have Category which should generate a tag and inside it should have its own data (details) so the end result should be like that (see  code below)  
<graph1 Name="Waste">
	<graph name="Jun 2010" value="8" />
	<graph name="July 2010" value="4" />
	<graph name="Aug 2010" value="0" />
	<graph name="Sep 2010" value="0" />
	<graph name="Oct 2010" value="0" />
	<graph name="Nov 2010" value="8" />
<graph2 Name="Water">
	<graph name="Jun 2010" value="34" />
	<graph name="July 2010" value="40" />
	<graph name="Aug 2010" value="1" />
	<graph name="Sep 2010" value="2" />
	<graph name="Oct 2010" value="38" />
	<graph name="Nov 2010" value="4" />

Many thanks in advance
Gertone (Geert Bormans)
Information Architect
Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros