<?xml version="1.0" ?><?xml-stylesheet href="rssFeed.xsl" type="text/xsl" ?><rss version="2.0" xmlns:merge="http://kinlan.co.uk/merge"> <channel> <title>Kinlan</title> <link> </link> <description>Kinlan RSS feed.</description> <managingEditor>Paul Kinlan</managingEditor> <webMaster>firstname.lastname@example.org</webMaster> <pubDate>Unknown</pubDate> <merge:Sources> <Source id="Technorati" href="http://feeds.technorati.com/feed/posts/tag/Styling" /> </merge:Sources> </channel></rss>
I then developed a simple XSLT that would scan this "plain" RSS feed and pull in the RSS feeds specified by the Source element. I know MSXML does this. There is the ability to import another set of nodes from an external document in MSXML's XSLT engine (it might be standard, I am not too sure).
<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:merge="http://kinlan.co.uk/merge"> <xsl:output method="xml"/> <xsl:template match="channel"> <xsl:copy-of select="/." /> <xsl:element name="rss" namespace=""> <xsl:apply-templates select="/rss/channel/merge:Sources/Source" /> </xsl:element> </xsl:template> <xsl:template match="/rss/channel/merge:Sources/Source"> <!--Import Some More Documents --> <xsl:copy-of select="document(@href)//item"/> </xsl:template></xsl:stylesheet>
I tested it locally and it worked! Bonus! This is easy I thought to myself. Here in front of me, I have 3 seperate RSS feeds merged into one simple feed. I thought on, with a little more development I could provide sorting, so that the output is sorted by date and all the feeds are merged in to one list.Then it hit me! I uploaded the xml and the xslt to my web server, I set it to so that it was pulling in two remote technorati feeds. I typed in the URL and .................... ERROR!Pants! Why did this happen?I quickly thought on.
- IE has security (no jokes please ;))
- IE has data island security
- I was essentially pulling in data from a domain other than the one I was in.
I was stopped in my tracks, I couldn't pull in anything that wasn't on my own domain (kinlan.co.uk). I took a little more time to think about what had happened and I realaised several other things that would stop me down the line.
- It is fine and dandy having data pulled in from different sources by the client that needs them, but there is no guarantee that the engine that pulls them in will have an XSLT Engine, let alone MSXML.
- If I wanted it all done on the client, I can't use any fancy AJAX stuff either, nor could I use any MSXML objects in the browser for the same reason as the previous point.
Both of the above points meant that if a non Internet Explorer client, perhaps RSS Bandit etc pulled down my feed all it would see is an empty blog with my custom elements.Oh well, if it worked it would have been cool, because it didn't work I have learnt some interesting stuff! :)Here are the links to the XML and the XSLT.
|IE7 [feed], Internet Explorer [feed], IE7 RSS Feeds [feed], RSS Feeds [feed], Internet Explorer 7 [feed], IE7 Annoyances [feed], Microsoft [feed], XML [feed], XSLT [feed]|
|IE7 [feed], Internet Explorer 7 [feed], IE7 RSS Feed [feed], Internet Expolrer [feed], Using XSLT to display RSS [feed]|
|Internet Expolrer [feed], IE7 [feed], IE7 RSS Feed Discovery [feed], Using XSLT to display RSS [feed]|