<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:content="http://purl.org/rss/1.0/modules/content/"
 version="1.0">

	<xsl:param name="feed-title" select="'The Daily Show Full Episode RSS Feed'" />
	<xsl:param name="feed-url" select="'daily.rss'" />
	<xsl:param name="showtime" select="'23:00 EST'" />
	<xsl:param name="month-offset" select="47" />

	<xsl:template match="/">
		<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:atom="http://www.w3.org/2005/Atom">
			<channel>
				<atom:link rel="self" type="application/rss+xml">
				<xsl:attribute name="href"><xsl:value-of select="$feed-url"/></xsl:attribute>
				</atom:link>
				
				<title><xsl:value-of select="$feed-title"/></title>
				<description><xsl:value-of select="$feed-title"/></description>
				<link>http://extechops.net/full-episode-feeds/</link>
			
				<xsl:apply-templates select=".//div[@class='moreEpisodesContainer-selected']"/>
				<xsl:apply-templates select=".//div[@class='moreEpisodesContainer']"/>
				
			</channel>
		</rss>
	</xsl:template>

	<xsl:template match="div">
<item>
	<xsl:variable name="air-date" select=".//div[@class='moreEpisodesAirDate']/span"/>
	<xsl:variable name="item-link" select=".//div[@class='moreEpisodesTitle']/span/a/@href"/>

	<title><xsl:value-of select=".//div[@class='moreEpisodesTitle']/span/a"/></title>
	<link><xsl:value-of select="$item-link"/></link>
    <pubDate>
    <xsl:value-of select="concat(substring($air-date,11,2), ' ', translate(substring($item-link,$month-offset,1),'jfmasond','JFMASOND'), substring($item-link,$month-offset+1,2), ' 20', substring($air-date,14,2), ' ', $showtime)"/>
    </pubDate>
	<description>
	<xsl:value-of select=".//div[@class='moreEpisodesDescription']"/>
	</description>
	<content:encoded>
	<xsl:copy-of select=".//div[@class='moreEpisodesImage']"/>
	<xsl:copy-of select=".//div[@class='moreEpisodesDescription']"/>
	</content:encoded>
	<guid isPermaLink="true"><xsl:value-of select=".//div[@class='moreEpisodesTitle']/span/a/@href"/></guid>
</item>
	</xsl:template>




</xsl:stylesheet>

