<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rss="http://purl.org/rss/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:admin="http://webns.net/mvcb/"
>

<xsl:output method="html"/>

<xsl:template match="/">
    <xsl:apply-templates select="/rdf:RDF/rss:channel"/>

    <xsl:for-each select="/rdf:RDF/rss:item">
        <xsl:call-template name="display_item">
            <xsl:with-param name="full" select="0"/>
        </xsl:call-template>
    </xsl:for-each>

    <xsl:for-each select="/rdf:RDF/rss:item">
        <xsl:call-template name="display_item">
            <xsl:with-param name="full" select="1"/>
        </xsl:call-template>
    </xsl:for-each>
</xsl:template>

<xsl:template match="/rdf:RDF/rss:channel">
    <h3 class="pageContent"><a href="{rss:link}" target="_blank"><xsl:value-of select="rss:title"/></a></h3>
    <xsl:apply-templates select="/rdf:RDF/rss:image"/>
    <xsl:call-template name="display_description"/>
    <xsl:call-template name="display_properties"/>
</xsl:template>

<xsl:template match="/rdf:RDF/rss:image">
    <a href="{rss:link}" title="{rss:title}" target="_blank">
        <img alt="{rss:title}" border="0">
            <xsl:attribute name="src"><xsl:value-of select="normalize-space(rss:url)"/></xsl:attribute>
            <xsl:if test="rss:width!=''"><xsl:attribute name="width"><xsl:value-of select="rss:width"/></xsl:attribute></xsl:if>
            <xsl:if test="rss:height!=''"><xsl:attribute name="height"><xsl:value-of select="rss:height"/></xsl:attribute></xsl:if>
        </img>
    </a>
</xsl:template>

<xsl:template name="display_properties">
    <div class="pageContent">
    <p>
    <xsl:if test="dc:date!=''">
        <xsl:value-of select="dc:date"/><br/>
    </xsl:if>
    </p>
    </div>
</xsl:template>

<xsl:template name="display_description">
    <div class="pageContent">
    <p>
		<xsl:value-of select="rss:description"/>
    </p>
    </div>
</xsl:template>

<xsl:template name="display_item">
    <xsl:param name="full"/>
    <xsl:choose>
        <xsl:when test="$full=1">
            <div class="pageContent">
            <a name="item{position()}"></a>
            <h5 class="pageContent">
                <xsl:value-of select="position()"/> - <a href="{rss:link}" class="pageContent" target="_blank"><xsl:value-of select="rss:title"/></a>
            </h5>
            <xsl:call-template name="display_description"/>
            <xsl:if test="content:encoded">
                <div class="pageContent">
                    <xsl:value-of select="content:encoded" disable-output-escaping="yes"/>
                </div>
            </xsl:if>
            <xsl:call-template name="display_properties"/>
            </div>
        </xsl:when>
        <xsl:otherwise>
            <span class="pageContent">
                <xsl:value-of select="position()"/> - <a href="#item{position()}" class="pageContent"><xsl:value-of select="rss:title"/></a><br/>
            </span>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>