Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Can anyone offer an explanation as to why I am unable to sort this XML descending by pubDate?
http://www.ignitetech.com/umbraco/plugins/FergusonMoriyama/feedcache/tmcnet.xml
<xsl:variable name="x" select="document('../umbraco/plugins/FergusonMoriyama/FeedCache/tmcnet.xml')/rss/channel"/><xsl:variable name="x-limit" select="2" />....<xsl:for-each select="$x/item"> <xsl:sort select="pubDate" order="descending" /> <xsl:if test="position() <= $x-limit"> ...... </xsl:if> </xsl:for-each>
I'm obviously trying to get the latest two items, but it's getting literally Random ones. What am I doing wrong here?
Thanks,
Garrett
Garrett,
Its due to format of pubdate you need to be ansi sql style 2010-10-11 etc
Regards
Ismail
Hi Garrett
xslt doesn't really do date sorting unless the date itself is ordered like a big number - there is no data-type "date" to sort by. This seems to work well for me
<xsl:sort select="umbraco.library:FormatDateTime(./articleDate, 'yyyyMMddhhmmss')" data-type="number" order="descending" />
Dan
Thanks very much Dan-- this fixed it.
//Garrett
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
XML Not Sorting
Hi,
Can anyone offer an explanation as to why I am unable to sort this XML descending by pubDate?
http://www.ignitetech.com/umbraco/plugins/FergusonMoriyama/feedcache/tmcnet.xml
I'm obviously trying to get the latest two items, but it's getting literally Random ones. What am I doing wrong here?
Thanks,
Garrett
Garrett,
Its due to format of pubdate you need to be ansi sql style 2010-10-11 etc
Regards
Ismail
Hi Garrett
xslt doesn't really do date sorting unless the date itself is ordered like a big number - there is no data-type "date" to sort by. This seems to work well for me
Dan
Thanks very much Dan-- this fixed it.
//Garrett
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.