I have the following xslt and I am trying to use two levels of
grouping. I am first grouping on the report category, then on the
report type. The problem is I am sure I have to apply some sort of
filter on the report type group to limit the records returned to the
current report category. Any help is appreciated.
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:key name="NewDataSet" match="Table" use="report_category"/>
<xsl:key name="report_Type" match="Table" use="report_type"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="NewDataSet">
<table width="400px" style="border-collapse: collapse;Font-family:
tahoma; FONT-SIZE: 10pt; COLOR: black" BORDER="0" cellSPACING="0"
cellpadding="2" >
<tr>
<td width="150px" bgcolor="gainsboro"><b>Category</b></td>
<td width="250px" bgcolor="gainsboro"><b>Report name</b></td>
</tr>
<!-- group by report category -->
<xsl:for-each
select="//Table[generate-id(.)=generate-id(key('NewDataSet',report_category))]">
<xsl:sort select="report_category" order="ascending"/>
<tr height="25px" bgcolor="whitesmoke">
<td colspan="2" style="border-top:solid 1px black; color:Black;
font-weight: bold;">
<xsl:value-of select="report_category"/>
</td>
</tr>
<!-- group by report type -->
<xsl:for-each
select="//Table[generate-id(.)=generate-id(key('report_Type',report_type))]">
<xsl:sort select="report_type" order="ascending"/>
<tr height="25px" bgcolor="whitesmoke">
<td colspan="2" style="border-top:solid 1px black; color:Black;
font-weight: bold;">
<xsl:value-of select="report_type"/>
</td>
</tr>
<xsl:for-each select="key('report_Type',report_type)">
<tr>
<td><xsl:value-of select="report_type"/></td>
<td align="left">
<a
href="Parameters.aspx?REPORT_INDEX={report_index}" ><xsl:value-of
select="report_display_name"/></a>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Here is the xml data:
<NewDataSet>
<Table>
<report_index>2</report_index>
<report_type>REPORT</report_type>
<report_display_name>Sales By Product Line</report_display_name>
<report_path>/Customer/Sales/Sales By Product Line</report_path>
<report_category>Sales</report_category>
</Table>
<Table>
<report_index>6</report_index>
<report_type>REPORT</report_type>
<report_display_name>Sales By Product Line with Safety
Breakout</report_display_name>
<report_path>/Customer/Sales/Sales By Product Code
Safety</report_path>
<report_category>Sales</report_category>
</Table>
</NewDataSet>