I have a collection of items, and i need to single out one item that has the closest date to the current date (in the future, not in the past). All this in xslt 1.0. Any suggestion开发者_如何学运维s to how this could be done?
Brother, this is what you can do:
List<Item> itemList = new List<Item>();
itemList = Sitecore.Context.Item.Axes.GetDescendants().ToList<Item>();
itemList = itemList.OrderByDescending(c => c.Statistics.Created.Date).ToList<Item>();
Where itemList is obviously the list you want to sort. Good luck!
And then i found out you're asking it to be XSL :):
<xsl:for-each select="item">
<xsl:sort select="sc:fld(__created,.)" />
More reference here at John West blog.
advise: The more complicated things you want to do in renderings the more you should consider to be using Sublayouts instead of XSL.
But good luck again!
精彩评论