I'm working with SharePoint 2007. I try to modify the DVWP with the XSLT.
The web part pulls the data from the list, what i want to do is just sort the data and show the results. - I can't sort the data directly because i need to sort / group by the field which is a choice field, so i can't.
The only viable solution for me was to modify the XSLT. Everything went good and well until I come across a problem and this problem is kind a strange.
When I use sort, it doesn't show the first value from the table! When i remove sort i have 4 (unique) values which i should have but they are not orderd, as soon as i get the sort inside the i get 3 unique values, which misses the first one. And i totaly do not understand how is it even possible.
I'll provide you pieces of XSLT which i use, as it my be an asset for helping me understand what i'm doing wrong.
To distinct the unique values i use this:
<xsl:key name="ByCategory" match="/dsQueryResponse/Rows/Row" use="@Category" />
In this subgroup (sub-template) i get this wierd behavior:
<xsl:call-template name="dvt_2.body">
<xsl:with-param name="Rows" select="$Rows" />
</xsl:call-template>
<xsl:template name="dvt_2.body">
<xsl:param name="Rows" />
<td>
<xsl:for-each select="$Rows[generate-id()=generate-id(key('ByCategory',@Category)[1])]">
<xsl:sort select="@Category"/>
<xsl:call-template name="dvt_2.rowview">
</xsl:call-template>
</xsl:for-each>
</td>
</xsl:template>
As i said before if i remove the sort, it will be ok, but unsorted, but i need sorting.
Any idea?
Thanks in advance
PS: if full xslt code is needed, i'll provide.