Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsWhy is this not sorting correctly? Please help.Why is this not sorting correctly? Please help.
Previous
 
Next
New Post
4/24/2009 6:30 PM
 

I am using the following rss feed:

http://www.hallindsey.org/thehallindseyreport.rss

My xsl looks like this:

 

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
  <!-- Do not show channel image -->

  <xsl:for-each select="channel/item">
  <xsl:if test="position() &lt; 6">
   <BR></BR>
   <strong>
    <a href="{link}" target="_new">
     <xsl:value-of select="title"/>
    </a>
   </strong>
   <br></br>
   <!-- only display markup for description if it's present -->
   <xsl:value-of disable-output-escaping="yes" select="description"/><xsl:text> </xsl:text>
   <I>
    <xsl:value-of disable-output-escaping="yes" select="substring(pubDate,1,16)"/>
   </I>
   <BR></BR>
  </xsl:if>
  </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

 

This same XSL file is being used for othe feeds and is sorting most current first.... however, on this one it is not sorting correctly... Can someone point me in the right direction? Thanks.

 

 
New Post
4/25/2009 6:27 PM
 

Well, you've run into the major problem with trying to have an all-inclusive sort method for RSS feeds.  Look at the pubDate in the source, and you'll see what you appear to be doing is taking the first chars of the pubDate to use as a sort key, but I don't really see you calling a sort routine.

        <pubDate>Sat, 31 Mar 2007 21:03:48 -0700</pubDate>
 

So, given that info, you would need to look at more of the date field to properly sort it.  Also, you say this is working for other feeds, and I'd like to see the URL for ones that are working, as I suspect the date format is different.  It's hard to know without having them to look at, though.

One, thing to try is parsing is testing the date format, then applying one of a few formatting translations to a sortable ascii format, hoping that you don't have language issues to blow up your algorithm.  Sorting by date is not an easy task, but if you google using xsl and sort date you'll see many examples to try.

 
New Post
4/29/2009 2:52 AM
 

Can someone help with this? I have no idea what I am doing.......

 
New Post
4/30/2009 8:45 AM
 

So, I guess you don't have any URL's where your example XSL worked? I'd still like to see them before I spend time 'helping'. 

 
New Post
4/30/2009 2:12 PM
 

Ok, if you really want the solution, you'll have to take a look at my blog where I provide a working XSL that illustrates how to sort a feed that renders in the new module.  The solution involves adding a custom namespace, and using an element that the module creates pubDateParsed to actual provide the key to sort on.

Cheers

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsWhy is this not sorting correctly? Please help.Why is this not sorting correctly? Please help.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out