<?xml version="1.0"?>
<!--
	SharpReader2RssBandit.xslt v1.0
	Travis Illig
	tillig@paraesthesia.com
	http://www.paraesthesia.com
	
	Export your list of feeds from SharpReader, then
	transform the output with this XSLT.  The resulting
	document can be imported into RSS Bandit and should
	include all categories (with hierarchy) and feeds.
-->
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://www.25hoursaday.com/2003/RSSBandit/feeds/">


	<xsl:template match="/">
		<feeds refresh-rate="3600000">
			<xsl:for-each select="/opml/body/outline">
				<xsl:call-template name="feeds" />
			</xsl:for-each>
			<categories>
				<xsl:for-each select="/opml/body/outline">
					<xsl:call-template name="categories" />
				</xsl:for-each>
			</categories>
		</feeds>
	</xsl:template>

	<xsl:template name="categories">
		<xsl:if test="not(@type = 'rss')">
			<category><xsl:call-template name="categoryname" /></category>
			<xsl:for-each select="outline">
				<xsl:call-template name="categories" />
			</xsl:for-each>
		</xsl:if>
	</xsl:template>
	
	<xsl:template name="categoryname">
		<xsl:if test="../@title"><xsl:for-each select=".."><xsl:call-template name="categoryname" /></xsl:for-each>\</xsl:if><xsl:value-of select="@title" />
	</xsl:template>
	
	<xsl:template name="feeds">
		<xsl:if test="@type = 'rss'">
			<feed>
				<xsl:if test="../@title">
					<xsl:attribute name="category">
						<xsl:for-each select="..">
							<xsl:call-template name="categoryname" />
						</xsl:for-each>
					</xsl:attribute>
				</xsl:if>
				<title><xsl:value-of select="@title" /></title>
				<link><xsl:value-of select="@xmlUrl" /></link>
				<stories-recently-viewed />
				<if-modified-since>0001-01-01T00:00:00.0000000-08:00</if-modified-since>
			</feed>
		</xsl:if>
		<xsl:for-each select="outline">
			<xsl:call-template name="feeds" />
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
