Share on Facebook
Welcome to MSDN Blogs Sign in | Join | Help

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>

 

 

Published Thursday, May 01, 2003 12:43 AM by kaevans

Comments

# RE: Organize Your OPML

Thursday, May 01, 2003 12:32 AM by Dare Obasanjo
Ummm, isn't SimpleGeek Chris Anderson's domain name while Joshua is NetCrucible?

# re: Organize Your OPML

Thursday, May 01, 2003 5:21 PM by Kirk Allen Evans
Errr... yeah... my brain fart.

# re: Organize Your OPML

Tuesday, November 04, 2003 3:02 PM by Paul Ferrill
So how do I use this snippet exactly?

# re: Organize Your OPML

Tuesday, November 04, 2003 4:21 PM by Kirk Allen Evans
The easiest way to use it is to save the OPML and the XSLT to separate files on your harddrive. Use something like the following code:

using System;
using System.Xml;
using System.Xml.Xsl;

namespace OPMLOrg
{
class Class1
{
static void Main(string[] args)
{
XslTransform trans = new XslTransform();
trans.Load(@"c:\projects\trans.xslt",new XmlUrlResolver());
trans.Transform(@"c:\projects\opml.xml",@"c:\projects\newopml.xml",new XmlUrlResolver());
}
}
}
New Comments to this post are disabled
 
Page view tracker