<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<html>
			<body>
				<h1>dretblog</h1>
				<xsl:for-each select="//post">
					<p><a href="{@date}"><xsl:value-of select="concat(format-date(@date, '[F] [MNn] [D], [Y]'), ': ', title)"/></a></p>
				</xsl:for-each>
			</body>
		</html>
		<xsl:for-each select="//post">
			<xsl:result-document href="{@date}.html">
				<html>
					<body>
						<h1><xsl:value-of select="title"/></h1>
						<h2><xsl:value-of select="format-date(@date, '[F] [MNn] [D], [Y]')"/></h2>
						<a href="../img/{image/@src}.jpg" title="{image}"><img src="../img/{image/@src}-small.jpg"/></a>
						<p><xsl:value-of select="text"/></p>
						<p>
							<xsl:if test="exists(preceding-sibling::post)"><a href="{preceding-sibling::post[1]/@date}">← </a></xsl:if>
							<a href="dretblog2">Home</a>
							<xsl:if test="exists(following-sibling::post)"><a href="{following-sibling::post[1]/@date}"> →</a></xsl:if>
						</p>
					</body>
				</html>
			</xsl:result-document>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
