<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:simple="http://my.netscape.com/rdf/simple/0.9/" xmlns:rss="http://purl.org/rss/1.0/"
	xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:atom="http://purl.org/atom/ns#"
	xmlns:atom1="http://www.w3.org/2005/Atom" xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:admin="http://webns.net/mvcb/" xmlns:icbm="http://postneo.com/icbm"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	exclude-result-prefixes="rdf simple rss dc dcterms content syn atom atom1 foaf admin icbm geo enc wfw">
	<xsl:output method="html"/>

	<xsl:param name="ListSize" select="10"/>


	<xsl:template match="/">
		<xsl:apply-templates select="/rdf:RDF[rss:channel or simple:channel]"/>
		<xsl:apply-templates select="/rss[@version]/channel"/>
		<xsl:apply-templates select="/redirect/newLocation"/>
		<xsl:apply-templates select="/atom:feed[@version='0.3']"/>
		<xsl:apply-templates select="/atom1:feed"/>
	</xsl:template>

	<xsl:template match="rss/channel">
		<div class="col size3of4">
			<xsl:call-template name="listItem"/>
		</div>

		<div class="col lastCol">
			<div class="box norm">
				<div class="box-i">
					<h4 class="box-first-h">
						<xsl:value-of select="title" disable-output-escaping="yes"/>
					</h4>
					<xsl:call-template name="listTitle"/>
					<p class="box-f">Kilde:<br/><a href="{link}">
							<xsl:value-of select="title" disable-output-escaping="yes"/>
						</a></p>
				</div>
			</div>
		</div>
	</xsl:template>

	<xsl:template match="/atom:feed|/atom1:feed">
		<div class="col-75-l">
			<xsl:call-template name="listAtomItem"/>
		</div>

		<div class="col-25-r">
			<div class="box norm">
				<div class="box-i">
					<h4 class="box-first-h">
						<xsl:apply-templates select="atom:title|atom1:title"/>
					</h4>
					<xsl:call-template name="listAtomTitle"/>
					<p class="box-f">Kilde:<br/>
						<xsl:element name="a">
							<xsl:attribute name="href">
								<xsl:apply-templates select="atom:link|atom1:link"/>
							</xsl:attribute>
							<xsl:apply-templates select="atom:title|atom1:title"/>
						</xsl:element>
					</p>
				</div>
			</div>
		</div>
	</xsl:template>

	<xsl:template match="atom:link|atom1:link">
		<xsl:if test="@rel = 'alternate'">
			<xsl:value-of select="@href"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="atom:title|atom1:title">
		<xsl:value-of select="." disable-output-escaping="yes"/>
	</xsl:template>

	<xsl:template match="/rdf:RDF">
		<div class="col-75-l">
			<xsl:call-template name="listRdfItem"/>
		</div>

		<div class="col-25-r">
			<div class="box norm">
				<div class="box-i">
					<h4 class="box-first-h">
						<xsl:value-of select="rss:channel/rss:title" disable-output-escaping="yes"/>
					</h4>
					<xsl:call-template name="listRdfTitle"/>
					<p class="box-f">Kilde:<br/><a href="{rss:channel/rss:link}">
							<xsl:value-of select="rss:channel/rss:title"
								disable-output-escaping="yes"/>
						</a></p>

				</div>
			</div>
		</div>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listTitle">
		<xsl:variable name="rssIdTemp" select="substring(title, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:for-each select="item">
			<xsl:if test="$ListSize >= position()">
				<p>
					<span class="highlight">&#8226;</span>&#160;<xsl:element name="a">
						<xsl:attribute name="href">#mp-<xsl:number/>A</xsl:attribute>
						<xsl:attribute name="onclick">javascript:$('.unicRssHide<xsl:value-of
								select="$rssId"/>').hide(); $('#mp-<xsl:value-of
								select="generate-id()"/>-<xsl:number/>').toggle(); return
							false;</xsl:attribute>
						<xsl:attribute name="title">Se indl&#230;g</xsl:attribute>
						<xsl:value-of select="title" disable-output-escaping="yes"/>
					</xsl:element>
					<xsl:choose>
						<xsl:when test="dc:date">
							<!-- Show date if available -->
							<br/>
							<xsl:call-template name="listDcDate"/>
						</xsl:when>
						<xsl:when test="pubDate">
							<!-- Show date if available -->
							<br/>
							<xsl:call-template name="listPubDate"/>
						</xsl:when>
						<xsl:otherwise/>
					</xsl:choose>
				</p>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listItem">
		<xsl:variable name="kilde" select="title"/>
		<xsl:variable name="kildeLink" select="link"/>
		<xsl:variable name="rssIdTemp" select="substring(title, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:for-each select="item">
			<xsl:if test="$ListSize >= position()">
				<div class="unicRssHide{$rssId}">
					<xsl:attribute name="id">mp-<xsl:value-of select="generate-id()"
						/>-<xsl:number/></xsl:attribute>
					<div class="box norm">
						<div class="box-i">
							<h4 class="box-first-h">
								<a href="{link}">
									<xsl:value-of select="title" disable-output-escaping="yes"/>
								</a>
							</h4>
							<p>
								<xsl:choose>
									<xsl:when test="count(./content:encoded) > 0">
										<xsl:value-of select="content:encoded"
											disable-output-escaping="yes"/>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="description"
											disable-output-escaping="yes"/>
									</xsl:otherwise>
								</xsl:choose>
							</p>
							<p class="box-f">
								<xsl:if test="count(./enclosure) > 0">
									<xsl:for-each select="enclosure">
										<xsl:element name="a"><xsl:attribute name="href">
												<xsl:value-of select="@url"/>
											</xsl:attribute> Tilh&#248;rende materiale </xsl:element>
										<br/>
									</xsl:for-each>
								</xsl:if>
								<xsl:choose>
									<xsl:when test="count(./wfw:commentRss) > 0">
										<a href="{link}">Se indl&#230;g med kommentarer</a> fra
											<a href="{$kildeLink}">
											<xsl:value-of select="$kilde"
												disable-output-escaping="yes"/>
										</a>
										<br/>
										<a href="{link}">Kommenter indl&#230;g</a>
									</xsl:when>
									<xsl:otherwise>
										<a href="{link}">Se hele indl&#230;gget</a> fra <a
											href="{$kildeLink}">
											<xsl:value-of select="$kilde"
												disable-output-escaping="yes"/>
										</a>
									</xsl:otherwise>
								</xsl:choose>
							</p>
						</div>
					</div>
				</div>
				<xsl:if test="position() > 1">
					<script type="text/javascript">
						javascript:$('#mp-<xsl:value-of select="generate-id()"/>-<xsl:number/>').toggle();
					</script>
				</xsl:if>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listAtomTitle">
		<xsl:variable name="kilde">
			<xsl:apply-templates select="atom:title|atom1:title"/>
		</xsl:variable>
		<xsl:variable name="rssIdTemp" select="substring($kilde, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:for-each select="atom:entry|atom1:entry">
			<xsl:if test="$ListSize >= position()">
				<p>
					<span class="highlight">&#8226;</span>&#160;<xsl:element name="a">
						<xsl:attribute name="href">#mp-<xsl:number/>A</xsl:attribute>
						<xsl:attribute name="onclick">javascript:$('.unicRssHide<xsl:value-of
								select="$rssId"/>').hide(); $('#mp-<xsl:value-of
								select="generate-id()"/>-<xsl:number/>').toggle(); return
							false;</xsl:attribute>
						<xsl:attribute name="title">Se indl&#230;g</xsl:attribute>
						<xsl:apply-templates select="atom:title|atom1:title"/>
					</xsl:element>
					<xsl:choose>
						<xsl:when test="atom:modified">
							<!-- Show date if available -->
							<br/>
							<xsl:call-template name="listAtomDate"/>
						</xsl:when>
						<xsl:otherwise/>
					</xsl:choose>
				</p>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listAtomItem">
		<xsl:variable name="kilde">
			<xsl:apply-templates select="atom:title|atom1:title"/>
		</xsl:variable>
		<xsl:variable name="rssIdTemp" select="substring($kilde, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:variable name="kildeLink">
			<xsl:apply-templates select="atom:link|atom1:link"/>
		</xsl:variable>
		<xsl:for-each select="atom:entry|atom1:entry">
			<xsl:if test="$ListSize >= position()">
				<div class="unicRssHide{$rssId}">
					<xsl:attribute name="id">mp-<xsl:value-of select="generate-id()"
						/>-<xsl:number/></xsl:attribute>
					<div class="box norm">
						<div class="box-i">
							<h4 class="box-first-h">
								<xsl:element name="a">
									<xsl:attribute name="href">
										<xsl:apply-templates select="atom:link|atom1:link"/>
									</xsl:attribute>
									<xsl:apply-templates select="atom:title|atom1:title"/>
								</xsl:element>
							</h4>
							<p>
								<xsl:choose>
									<xsl:when test="count(atom:summary) > 0">
										<xsl:value-of select="atom:summary"
											disable-output-escaping="yes"/>
									</xsl:when>
									<xsl:when test="count(atom1:summary) > 0">
										<xsl:value-of select="atom1:summary"
											disable-output-escaping="yes"/>
									</xsl:when>
								</xsl:choose>
							</p>
							<p class="box-f">
								<xsl:for-each select="atom:link|atom1:link">
									<xsl:choose>
										<xsl:when test="@rel = 'enclosure'">
											<xsl:element name="a"><xsl:attribute name="href">
												<xsl:value-of select="@href"/>
												</xsl:attribute> Tilh&#248;rende materiale </xsl:element>
											<br/>
										</xsl:when>
									</xsl:choose>
								</xsl:for-each>
								<xsl:element name="a"><xsl:attribute name="href">
										<xsl:apply-templates select="atom:link|atom1:link"/>
									</xsl:attribute> Se hele indl&#230;gget </xsl:element> fra
									<a href="{$kildeLink}">
									<xsl:value-of select="$kilde"/>
								</a>
							</p>
						</div>
					</div>
				</div>
				<xsl:if test="position() > 1">
					<script type="text/javascript">
						javascript:$('#mp-<xsl:value-of select="generate-id()"/>-<xsl:number/>').toggle();
					</script>
				</xsl:if>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listRdfTitle">
		<xsl:variable name="kilde">
			<xsl:apply-templates select="rss:channel/rss:title"/>
		</xsl:variable>
		<xsl:variable name="rssIdTemp" select="substring($kilde, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:for-each select="rss:item">
			<xsl:if test="$ListSize >= position()">
				<p>
					<span class="highlight">&#8226;</span>&#160;<xsl:element name="a">
						<xsl:attribute name="href">#mp-<xsl:number/>A</xsl:attribute>
						<xsl:attribute name="onclick">javascript:$('.unicRssHide<xsl:value-of
								select="$rssId"/>').hide(); $('#mp-<xsl:value-of
								select="generate-id()"/>-<xsl:number/>').toggle(); return
							false;</xsl:attribute>
						<xsl:attribute name="title">Se indl&#230;g</xsl:attribute>
						<xsl:value-of select="rss:title" disable-output-escaping="yes"/>
					</xsl:element>
					<xsl:choose>
						<xsl:when test="dc:date">
							<!-- Show date if available -->
							<br/>
							<xsl:call-template name="listDcDate"/>
						</xsl:when>
						<xsl:otherwise/>
					</xsl:choose>
				</p>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<xsl:template name="listRdfItem">
		<xsl:variable name="kilde">
			<xsl:apply-templates select="rss:channel/rss:title"/>
		</xsl:variable>
		<xsl:variable name="kildeLink" select="rss:channel/rss:link"/>
		<xsl:variable name="rssIdTemp" select="substring($kilde, 1, 10)"/>
		<xsl:variable name="rssId" select="translate($rssIdTemp, ' ,.;:', '-----')"/>
		<xsl:for-each select="rss:item">
			<xsl:if test="$ListSize >= position()">
				<div class="unicRssHide{$rssId}">
					<xsl:attribute name="id">mp-<xsl:value-of select="generate-id()"
						/>-<xsl:number/></xsl:attribute>
					<div class="box norm">
						<div class="box-i">
							<h4 class="box-first-h">
								<a href="{rss:link}">
									<xsl:value-of select="rss:title" disable-output-escaping="yes"/>
								</a>
							</h4>
							<p>
								<xsl:value-of select="rss:description" disable-output-escaping="yes"
								/>
							</p>
							<p class="box-f">
								<a href="{rss:link}">Se hele indl&#230;gget</a> fra <a
									href="{$kildeLink}">
									<xsl:value-of select="$kilde" disable-output-escaping="yes"/>
								</a>
							</p>
						</div>
					</div>
				</div>
				<xsl:if test="position() > 1">
					<script type="text/javascript">
						javascript:$('#mp-<xsl:value-of select="generate-id()"/>-<xsl:number/>').toggle();
					</script>
				</xsl:if>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>


	<!--#####################      FUNCTION 	#####################-->
	<!--## <pubDate>Fri, 29 Sep 2006 14:16:42 +0200</pubDate> #####-->
	<!--## <pubDate>19 Nov 2008 09:20:00 +0100</pubDate> #####-->
	<xsl:template name="listPubDate">
		<xsl:variable name="after1">
			<xsl:choose>
				<xsl:when test="contains(pubDate, ',')">
					<xsl:value-of select="substring-after(pubDate, ', ')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="pubDate"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="day" select="substring-before($after1, ' ')"/>
		<xsl:variable name="after2" select="substring-after($after1, ' ')"/>
		<xsl:variable name="month1" select="substring-before($after2, ' ')"/>
		<xsl:variable name="after3" select="substring-after($after2, ' ')"/>
		<xsl:variable name="year" select="substring-before($after3, ' ')"/>
		<xsl:variable name="month">
			<xsl:choose>
				<xsl:when test="$month1= 'Jan'">01</xsl:when>
				<xsl:when test="$month1= 'Feb'">02</xsl:when>
				<xsl:when test="$month1= 'Mar'">03</xsl:when>
				<xsl:when test="$month1= 'Apr'">04</xsl:when>
				<xsl:when test="$month1= 'May'">05</xsl:when>
				<xsl:when test="$month1= 'Jun'">06</xsl:when>
				<xsl:when test="$month1= 'Jul'">07</xsl:when>
				<xsl:when test="$month1= 'Aug'">08</xsl:when>
				<xsl:when test="$month1= 'Sep'">09</xsl:when>
				<xsl:when test="$month1= 'Oct'">10</xsl:when>
				<xsl:when test="$month1= 'Nov'">11</xsl:when>
				<xsl:when test="$month1= 'Dec'">12</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$month1"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable> (<xsl:value-of select="$day"/><xsl:text>/</xsl:text><xsl:value-of
			select="$month"/>&#160;<xsl:value-of select="$year"/>) </xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<!--## <dc:date>2006-10-04T17:06:42Z</dc:date>            #####-->
	<xsl:template name="listDcDate">
		<xsl:variable name="year" select="substring-before(dc:date, '-')"/>
		<xsl:variable name="after1" select="substring-after(dc:date, '-')"/>
		<xsl:variable name="month" select="substring-before($after1, '-')"/>
		<xsl:variable name="after2" select="substring-after($after1, '-')"/>
		<xsl:variable name="day" select="substring($after2, 1, 2)"/> (<xsl:value-of select="$day"
			/><xsl:text>/</xsl:text><xsl:value-of select="$month"/>&#160;<xsl:value-of
			select="$year"/>) </xsl:template>

	<!--#####################      FUNCTION 	#####################-->
	<!--## <modified>2006-10-04T17:06:42Z</modified>          #####-->
	<xsl:template name="listAtomDate">
		<xsl:variable name="year" select="substring-before(atom:modified, '-')"/>
		<xsl:variable name="after1" select="substring-after(atom:modified, '-')"/>
		<xsl:variable name="month" select="substring-before($after1, '-')"/>
		<xsl:variable name="after2" select="substring-after($after1, '-')"/>
		<xsl:variable name="day" select="substring($after2, 1, 2)"/> (<xsl:value-of select="$day"
			/><xsl:text>/</xsl:text><xsl:value-of select="$month"/>&#160;<xsl:value-of
			select="$year"/>) </xsl:template>
</xsl:stylesheet>

