I finally had some time on my hands to get some work done on my blog template. I was annoyed by the fact that the EBE:lists Other Blogs, Links and Archive were sorted in a non-logical way. I wanted the Archive to sort descending and sort the links ascending on the name instead of the ID. It was on my to-do list and this weekend I corrected it. Want to know how? Read on!
For adding a sorting method you need to edit the <xsl:template match="/"> tag, so first find it within your xsl file and you're ready.
In this example I'm editing my MounthCount.xsl for I would like the list to be sorted "descending".
The standard coding is as follows;
<xsl:template match="/">
<xsl:apply-templates select="rows/row[generate-id(.) = generate-id(key('months', substring(PublishedDate, 0, 8)))]" />
</xsl:template>
Now you need to add the next line before the /xsl:template tag to define the kind of sorting you would like and off course for which column it's intended;
<xsl:sort select="PublishedDate" order="descending"/>
Next stop is removing the "/" in the xsl:apply-templates tag, so the xsl:sort tag will run. But you do have to close the xsl:applying-templates tag, otherwise it won't work off course. Your code would look like this;
<xsl:apply-templates select="rows/row[generate-id(.) = generate-id(key('months', substring(PublishedDate, 0, 8)))]">
<xsl:sort select="PublishedDate" order="descending"/>
</xsl:apply-templates>
Now your Archive list in your template is sorted descending!
If you want your Links list to sort on the description instead of the URL, use the following string <xsl:sort select="substring-after(URL,',')">.