I wanted to update my blogroll on my weblog but because I’m subscribed to quite some rss feeds I did not wanted to do this manually. There had to be an easier way to do this. And I was correct, after doing some Googling I found out that you could use XSL transformation to convert OPML to HTML. But I’m not a XSL (EXtensible Stylesheet Language) or XML specialist but luckily I went yesterday evening to a session (TechNight) about tooling from my company. And one of the tools demo-ed was XML Spy which I tried to use with the XSL template downloaded from Keyvan Nayyeri blog about creating a Blogroll from OPML Files. But this template did not completely worked for Outlook exported RSS feeds
So after this demo I just asked who knew more about XML and XLS and with the help of Wouter van der Harg I’ve now XSLT (XSL Transformations) which transforms the Outlook OPML file to a Blogroll HTML file. Kudos’ to Wouter!
So here are the steps for creating a Blogroll from your Outlook RSS feeds.
- Use the Outlook Import and Export Wizard to Export your RSS Feeds to an OPML file.
- Rename the *.opml file to *.xml
- Open in XML Spy (or an other XML editor) the Exported RSS Feeds XML.
- Assign the XSL Template to the Exported RSS Feeds XML file.
- Click on XSL Transformation and your Blogroll is created.
XSL Template
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/> <xsl:template match="/opml"> <xsl:text disable-output-escaping="yes"><![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ]]></xsl:text> <html xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title> <xsl:value-of select="head/title/text()" /> </title> <style type="text/css"> a:link, a:active, a:visited, a:hover { color: #ce0000; text-decoration: none; } </style> </head> <body> <h1> <xsl:value-of select="head/title/text()" /> </h1> <ul> <xsl:apply-templates select="body/outline"> <xsl:sort select="@text" data-type="text" order="ascending" case-order="upper-first"/> </xsl:apply-templates> </ul> </body> </html> </xsl:template> <xsl:template match="outline"> <li> <xsl:attribute name="class"> <xsl:value-of select="@type" /> </xsl:attribute> <a> <xsl:attribute name="href"> <xsl:value-of select="@htmlUrl" /> <xsl:if test="not(@htmlUrl)"> <xsl:value-of select="@xmlUrl" /> </xsl:if> </xsl:attribute> <xsl:value-of select="@text" /> </a> </li> </xsl:template> </xsl:stylesheet>
Regards,
Stefan Stranger
http://weblog.stranger.nl




Entries (RSS)