Kirk Evans Blog

.NET From a Markup Perspective

Organize Your OPML

I really like the ability to organize the subscriptions I have within SharpReader and RSSBandit.  However, the tree view metaphor makes organization cumbersome, espeically if you come up with a reorganization scheme.  I decided to group my subscriptions by their associated entity (ie., DevelopMentor, Microsoft, DotNetWebLogs, Kuro5hin, Radio), which would get me 90% of the way that I needed to go, organizationally.  I know of the few others that don’t fit (like Joshua Allen, whose URL “SimpleGeek” does not fit within the “gotdotnet.com” match type), but overall this approach works for me.  Thought it might work for someone else as well.

<xsl:stylesheet version =”1.0 xmnlns:xsl =”http://www.w3.org/1999/XSL/Transform >
<xsl:template match =”/ >
<opml>
<body>
<outline title =”MSDN >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’msdn.microsoft.com’) or contains(@htmlUrl,’microsoft.com’)] >
<xsl:sort select =”@title />
</xsl:apply-templates>
</outline>
<outline title =”Microsoft >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’gotdotnet’)] >
<xsl:sort select =”@title />
</xsl:apply-templates>
</outline>
<outline title =”DevelopMentor >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’develop.com’)] >
<xsl:sort select =”@title />
</xsl:apply-templates>
</outline>
<outline title =”DotNetWebLogs >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’dotnetweblogs.com’)] />
</outline>
<outline title =”kuro5hin >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’kuro5hin.org’)] />
</outline>
<outline title =”Radio >
<xsl:apply-templates select =”opml/body/descendant::outline[contains(@xmlUrl,’userland.com’) or contains(@xmlUrl,’radio.weblogs.com’)] >
<xsl:sort select =”@title />
</xsl:apply-templates>
</outline>
<outline title =”General >
<xsl:apply-templates select =”opml/body/descendant::outline[@xmlUrl and not(contains(@xmlUrl,’develop.com’) or contains(@xmlUrl,’gotdotnet’) or contains(@xmlUrl,’dotnetweblogs.com’) or contains(@xmlUrl,’msdn.microsoft.com’) or contains(@xmlUrl,’userland.com’) or contains(@htmlUrl,’microsoft.com’) or contains(@xmlUrl,’kuro5hin.org’) or contains(@xmlUrl,’radio.weblogs.com’))] >
<xsl:sort select =”@title />
</xsl:apply-templates>
</outline>
</body>
</opml>
</xsl:template>
<xsl:template match =”outline >
<xsl:element name =”outline >
<xsl:apply-templates select =”@* />
</xsl:element>
</xsl:template>
<xsl:template match =”@* >
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>