﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:import href="FeedData.xslt"/>
    <xsl:import href="ChannelFeedData.xslt"/>

    <xsl:output omit-xml-declaration ="yes"/>

    <xsl:template match="/">

        <xsl:variable name="HostName" select="normalize-space(Publications/HostName)"></xsl:variable>
        <xsl:variable name="TemplateURL" select="normalize-space(Publications/TemplateURL)"/>

        <rss version="2.0" 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
             xmlns:wfw="http://wellformedweb.org/CommentAPI/"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
             xmlns:georss="http://www.georss.org/georss"
             xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
             xmlns:media="http://search.yahoo.com/mrss/">

            <channel>
                <xsl:call-template name="ChannelFeedData">
                    <xsl:with-param name="Title">LifeSpace</xsl:with-param>
                    <xsl:with-param name="Link">
                        <xsl:text>http://</xsl:text>
                        <xsl:value-of select="$HostName" />
                        <xsl:text>/Publications/Feed</xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="Description">List of our latest publications...</xsl:with-param>
                    <xsl:with-param name="ImageUrl">
                        <xsl:text>http://</xsl:text>
                        <xsl:value-of select="$HostName"></xsl:value-of>
                        <xsl:text>/DesktopModules/LifeSpaceTemplates/Web/Images/LifeSpaceLogo.jpg</xsl:text>
                    </xsl:with-param>
                    <xsl:with-param name="ImageLink">
                        <xsl:text>http://</xsl:text>
                        <xsl:value-of select="$HostName"></xsl:value-of>
                        <xsl:text>/Home.aspx</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>

                <xsl:for-each select="Publications/Publication">
                    <xsl:call-template name="FeedData">
                        <xsl:with-param name="Title" select="Title"></xsl:with-param>
                        <xsl:with-param name="Link">
                            <xsl:text>http://</xsl:text>
                            <xsl:value-of select="$HostName"></xsl:value-of>
                            <xsl:text>/Publication.aspx?ID=</xsl:text>
                            <xsl:value-of select="normalize-space(ItemID)"/>
                        </xsl:with-param>
                        <xsl:with-param name="Description" select="Summary"></xsl:with-param>
                    </xsl:call-template>
                </xsl:for-each>
            </channel>
        </rss>
    </xsl:template>
</xsl:stylesheet>
