Forum

Directory Index sorting the listing

Odd-Jarle Kristoffersen
14 December 2013, 07:41
I'm having trouble editing the index.xslt and making it sort by date/time in a descending order.

I've tried to change for-each loop adding a sort parameter:

<xsl:for-each select="files/file">
<xsl:sort select="@timestamp" order="descending"/>

However, it seems it sorts the timestamp rather strangely. Actually as time tamp is a text string which causes all files creates on ie. 31st of any month to be listed first, then the files on the 30th etc. Which I guess is what the XSL manual says about sort (default text string, but supports number and name).

I can't seem to find a sort option that will list the directory with the newest file on top, and then older files following it.

Any tips on how to achieve this?

Hiawatha version: 9.2.1
Operating System: CentOS 6.4 64-bit
Hugo Leisink
14 December 2013, 11:19
I'm afraid this won't work, because @timestamp is a text field, not a date field.
This topic has been closed.