Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gordon Saxby 1461 posts 1883 karma points
    Dec 14, 2010 @ 04:01
    Gordon Saxby
    0

    Merge and Sort different types of RSS feed

    I am trying to find a way of reading multiple RSS feeds, merging them together and sorting them by date. The feeds could be from anywhere / of any type, e.g. atom 0.3, atom 1.0, RSS 1.0, RSS 2.0, etc.

    I have seen this http://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/reading-rss-feeds,-aggregating-and-sorting but it (seems to) assume the feeds are of the same type as "pubDate" is RSS. atom feeds use "issued" and "modified".

    This page http://dawoe.blogspot.com/2008/03/transforming-feedsone-xslt-to-rule-them.html was extremely useful in terms of reading / handling the different types of feed - however it doesn't handle sorting the resulting data. Could "drawLinks" be updated to create a "temporary" XML file which could then be sorted?

  • Thijs Kuipers 43 posts 66 karma points
    Dec 15, 2010 @ 09:50
    Thijs Kuipers
    0

    When you wrap the templates in a variable, you could create an in-memory nodeset, over which you could sort and iterate. Each template would, like in your second linked example, create the same output for each differing feed.

    So where it now says (in your first link) "<xsl:copy-of select='umbraco.library:GetDocumentByURL…'/>" you would first transform each feed to some general representation on which you could sort. How you could create multiple matching templates for each differing type is explained in your second linked article.

  • Bart de Jonge 29 posts 51 karma points
    Dec 15, 2010 @ 10:46
    Bart de Jonge
    0

    you can do some nice things with yahoo pipes too :-)

  • Thijs Kuipers 43 posts 66 karma points
    Dec 15, 2010 @ 14:54
    Thijs Kuipers
    0

    That's pretty clever @Bart de Jonge!

    When you use Yahoo pipes and don't want to go over the usage limit, you can cache the results of "umbraco.library:GetDocumentByUrl()" using the second argument of that function in seconds (e.g. "umbraco.library:GetDocumentByUrl('http://domain/feed', 900)" for 15 minutes). It's a good idea in any scenario not to fetch the feed for every request you get on your site, as it may slowdown the end-user experience (while your server is waiting on someone else's server).

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 15, 2010 @ 15:01
    Darren Ferguson
    0

    @thijs - see Feed Cache in the projects section.

Please Sign in or register to post replies

Write your reply to:

Draft