I am sorting news article documents, by publicationDate, but I would like them to also be sorted by the time within the publicationDate, so the most recently published articles, that are published on the same date, would be at the top of the list. Here is what I have currently, what additions, could make this work?
The <xsl:sort> you've specified should do that automatically — that is, if the publicationDate property is a standard DatePicker (or DatePicker with Time).
Could you maybe show an example of five or six article's dates and how you'd like them to output?
It is a standard DatePicker. Does it have to be DatePicker with Time to sort articles published on the same date in the order they were most recently published?
If so, will changing this in the docType cause issues for all the previously published articles. We have around 900.
I switched the data type on the "PublicationDate" property for my news articles from a DatePicker to DatePicker with Time and tried changing some of the publicationDates to be the same day with different times, but changing the time doesn't alter the position in the sort. Do I need to change something in my xslt to check for time as well?
Just changing the data type to "Date Picker with Time" within the DocType for the news articles and it worked. Of course, I had to assign a time to the news articles created previously to get them to sort by time of day, but it works non the less.
I appreciate you help!
XSLT Sort by publicationDate with Time
I am sorting news article documents, by publicationDate, but I would like them to also be sorted by the time within the publicationDate, so the most recently published articles, that are published on the same date, would be at the top of the list. Here is what I have currently, what additions, could make this work?
Hi Steve,
The
<xsl:sort>
you've specified should do that automatically — that is, if thepublicationDate
property is a standard DatePicker (or DatePicker with Time).Could you maybe show an example of five or six article's dates and how you'd like them to output?
/Chriztian
I would probably use a grouping method like Muenchian Grouping.
http://www.jenitennison.com/xslt/grouping/muenchian.html
And then group by day, sort by time.
Chriztian,
It is a standard DatePicker. Does it have to be DatePicker with Time to sort articles published on the same date in the order they were most recently published?
If so, will changing this in the docType cause issues for all the previously published articles. We have around 900.
I switched the data type on the "PublicationDate" property for my news articles from a DatePicker to DatePicker with Time and tried changing some of the publicationDates to be the same day with different times, but changing the time doesn't alter the position in the sort. Do I need to change something in my xslt to check for time as well?
Hi Steve,
You really shouldn't have to change it, no...
If you output the publicationDate - are they not sorted correctly?
For example, try this:
/Chriztian
Thanks Chriztian!
Just changing the data type to "Date Picker with Time" within the DocType for the news articles and it worked. Of course, I had to assign a time to the news articles created previously to get them to sort by time of day, but it works non the less. I appreciate you help!
is working on a reply...