SharePoint 2007 DataFormWebPart Custom XSLT Grouping
I need some help with a multiple grouping issue I've been having.
I need three loops:
I have several offices (1, 2, 3, 4, ect...)
Each office has 4+ categories
Each category has any number of records in each category.
All of the data is stored in one list:
<!-- LOOP OFFICES -->
<xsl:for-each select="/dsQueryResponse/Rows/Row[not (@OfficeName=following::Row/@OfficeName)]">
<xsl:call-template name="Offices">
<xsl:with-param name="Office" select="@Office">
</xsl:call-template>
</xsl:for-each>
<xsl:template name="Offices">
<xsl:param name="Office">
<!-- LOOP CATEGORIES -->
<xsl:for-each select="/dsQueryResponse/Rows/Row[@Office=$Office and not (@Category=preceding-sibling::Row/@Category)]">
<xsl:call-template name="Categories">
<xsl:with-param name="Office" select="$Office">
<xsl:with-param name="Category" select="@Category">
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="Categories">
<xsl:param name="Office">
<xsl:param name="Category">
<!-- LOOP RECORDS -->
<xsl:for-each select="/dsQueryResponse/Rows/Row[@Office=$Office and @Category=$Category]">
<xsl:call-template name="Records">
<xsl:with-param name="Office" select="$Office">
<xsl:with-param name="Category" select="@Category">
<xsl:with-param name="Record" select="@Record">
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="Records">
<xsl:param name="Office">
<xsl:param name="Category">
<xsl:param name="Record">
<!-- DISPLAY RECORD -->
</xsl:template>
I don't think I should be using preceding-sibling.
Any help would be greatly appreciated!
April 20th, 2011 4:17pm