<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    exclude-result-prefixes="">

    <xsl:output method="xml" indent="yes"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" /> 

    <xsl:template match="/opml">
        <html>
            <head>
                <title><xsl:value-of select="head/title" /></title>
                <link rel="stylesheet" href="http://decafbad.com/2005/11/gopher-ng/hblogroll.css" type="text/css" />
            </head>
            <body>
                <h1><xsl:value-of select="head/title" /></h1>
                <ul class="blogroll xoxo">
                    <xsl:for-each select="body">
                        <xsl:apply-templates mode="outline" />
                    </xsl:for-each>
                </ul>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="outline" mode="outline">
        <li>
            <xsl:choose>
                <xsl:when test="@type='rss' or @xmlUrl">
                    <xsl:attribute name="class">rss</xsl:attribute>
                    <a class="xmlUrl" type="application/xml" href="{@xmlUrl}">XML</a>
                    <xsl:choose>
                        <xsl:when test="@htmlUrl">
                            <a class="htmlUrl" href="{@htmlUrl}" title="{@description}"><xsl:value-of select="@text | @title" /></a>
                        </xsl:when>
                        <xsl:when test="@description">
                            <abbr title="{@description}"><xsl:value-of select="@text | @title" /></abbr>
                        </xsl:when>
                        <xsl:otherwise>
                            <span class="description"><xsl:value-of select="@text | @title" /></span>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:when>
                <xsl:when test="@type='link'">
                    <xsl:attribute name="class">link</xsl:attribute>
                    <a href="{@url}"><xsl:value-of select="@text | @title" /></a>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="class">text</xsl:attribute>
                    <span><xsl:value-of select="@text | @title" /></span>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:if test="./outline">
                <ul><xsl:apply-templates mode="outline" /></ul>
            </xsl:if>
        </li>
    </xsl:template>
    
</xsl:stylesheet>

