Home » Tips, XML

Converting RSS Reader XML to OPML

Submitted by on July 8, 2006 – 7:21 am 2,480 views No Comment

A little over a year ago I started using RSSReader to manage all of my RSS feeds. In that time, I’ve acculated a little over 100 different feeds. Since I recently switched over to a Mac I started searching for a comparable solution.

One that immediately impressed me was Vienna for Mac OS X. I needed to figure out how to export all of my feeds from RSSReader on Windows into Vienna on Mac, so I began by looking at what the export options were for RSSReader. It turns out that RSSReader does export to XML, however the format is proprietary. Vienna supports OPML (Outline Processor Markup Langauge) which is a common standard, so I figured somebody must have come up with the solution to transform. Whipping up a quick Perl script to do this should have been easy, but after programming all day for a living I wasn’t really in the mood ;)

I Googled and came across a great example of how to do this with XSLT from http://pb.meselia.net/it/rssreader-opml. The program for running the conversion used cscript (via the windows scripting host) and javascript. I decided to go a slightly different route for processing the XSLT by installing AquaXSL on my Mac.

I exported my RSSReader subscriptions to export.xml, cut n’ pasted the example XSLT stylesheet and transformed… Wallah! A new feeds.opml was created. I imported into Vienna and it worked, but none of my groups were retained. Only a top-level group called Subscriptions was created. After some quick inspection, I updated the original XSLT to look for the group names and everything imported as expected. Here is a copy updated XSLT. This can also be downloaded at http://eric-blue.com/projects/snippets/rssreader_to_opml.xslt.

Credits to the original author from the pollution.kills blog:


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<opml version="1.0">
<head>
<title>RssReader Subscriptions</title>
<dateCreated />
<ownerName />
</head>
<body>
<xsl:for-each select="rssreader/feeds/item">
<xsl:element name="outline">
<xsl:attribute name="title" >
<xsl:value-of select="group"/>
</xsl:attribute>
<xsl:element name="outline">
<xsl:attribute name="title" >
<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:attribute name="xmlUrl" >
<xsl:value-of select="link" />
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:for-each>
</body>
</opml>
</xsl:template>
</xsl:stylesheet>

Post to Twitter Post to Delicious

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.