<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns="http://www.w3.org/1999/xhtml">

<xsl:output method="html"/>

<xsl:template match="/">
	<html lang="{{tpl:BlogLanguage}}">
		<head>
			<title>{{tpl:lang Subscribe to}} <xsl:value-of select="/rss/channel/title"/></title>
			<style type="text/css">
			<![CDATA[
			body{font:80% Verdana,Arial,sans-serif;padding:0;background:#fff;color:#000}a{color:#039}h1,h2{font-family:Arial,sans-serif}h1{font-size:160%;margin:0}h2{font-size:140%;font-weight:bold;margin:0.5em 0 0.2em}h2 a{text-decoration:none}p{margin:0 0 0.5em}@media (min-width: 53.125em){#page{margin:0 5em}body{margin:1.5em 0}}#top{background:#036;padding:1em;color:#fff}#top a{color:#fff;text-decoration:none}#what{padding:1em;background:#eee;border-bottom:1px solid #000;font-size:80%}#what p{margin:0 0 0.5em}#footer{border-top:1px solid #000}#items{background:#fff;color:inherit}#items div{margin:0 0 1em}input{width:90%}
			]]>
			</style>
			<script type="text/javascript"><![CDATA[
				window.onload = function() {
					document.getElementById('feedurl').value = window.location.href;

					// Ugly but works ;)
					var c = document.getElementsByTagName('div');
					var t = '';
					for (var i=0; c.length-i != 0; i++) {
						if (c[i].className == 'item-content') {
							if (c[i].textContent) {
								t = c[i].textContent;
							} else if (c[i].innerText) {
								t = c[i].innerText;
							} else {
								t = '';
							}

							if (t) { c[i].innerHTML = t; }
						}
					}
				};
			]]></script>
		</head>
		<body>
			<div id="page">
				<header id="top" role="banner">
					<h1><a href="{/rss/channel/link}"><xsl:value-of select="/rss/channel/title"/></a></h1>
					<p><xsl:value-of select="/rss/channel/description"/></p>
				</header>
				<div id="what">
					<h2>{{tpl:lang What is an RSS feed?}}</h2>
					<p>{{tpl:lang RSS feed is a free blog summary. It provides content
					(either posts or comments) or  summaries of content, together with links
					to the full versions, and other metadata. The last published items may
					then be read by your favorite RSS
					<a href="http://en.wikipedia.org/wiki/Aggregator">aggregator</a>.}}</p>
					<h3>{{tpl:lang Subscribe}}</h3>
					<p><label for="feedurl">{{tpl:lang Simply copy the following URL into your aggregator:}}</label></p>
					<p><input type="text" value="" id="feedurl" /></p>
				</div>
				<main id="items" role="main">
					<xsl:apply-templates select="//item"/>
				</main>
				<footer id="footer" role="contentinfo">
					<p><xsl:value-of select="/rss/channel/copyright"/></p>
				</footer>
			</div>
		</body>
	</html>
</xsl:template>

<!-- Item template -->
<xsl:template match="item">
	<div>
		<h2><a href="{link}"><xsl:value-of select="title"/></a></h2>
		<div class="item-content"><xsl:value-of select="description" /></div>
	</div>
</xsl:template>

</xsl:stylesheet>
