<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fn="http://www.w3.org/2005/02/xpath-function">

<xsl:template match="/">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="books">
	<html>
		<head>
			<link rel="stylesheet" type="text/css" href="schizo.css"/>
			<title>Book Ratings -- Adam Chlipala</title>
		</head>

		<body>
			<center><img src="img/books.png" alt="Book Ratings" width="483" height="158"/></center>
			<br/>

			<div class="summary">
				<p>Finding good books today isn't all that easy. I created this page to record what I've thought of the books I've read. Reading it should help you get an idea of how similar our tastes are. If we like the same things and I've missed one of your favorites, then what are you doing still sitting there on your hands? <a href="mailto:adam@schizomaniac.net">E-mail me already</a>! Even better, create a page like this and bring civilization closer to a state of perfect literary harmony.</p>

				<ul>
					<li> <b>Favorite Fiction</b>. I've grouped my favorite fiction authors into three strata of awesomeness. Within each stratum, the authors are listed in alphabetical order. Each author's books are listed roughly in descending order of how much I enjoyed them. Click on <img src="img/entry.png"/> icons next to books to jump to my book log and see my comments on the book and what I was reading at around the same time.
					<ul>
						<xsl:for-each select="ranking">
							<li> <a href="#{@id}"><xsl:value-of select="@name"/></a>: <xsl:value-of select="description/text()"/></li>
						</xsl:for-each>
					</ul></li>

					<li> <b><a href="#nonfic">Nonfiction</a></b></li>

					<!--li> <b><a href="#notso">Not-so-favorites</a></b>. These are authors that I haven't liked.</li-->
				</ul>

				<a href="bookLog.html">A chronological log of what I've read</a> is on a separate page.
			</div>

			<xsl:for-each select="ranking">
				<a name="{@id}"><div class="project">
					<h2><xsl:value-of select="@name"/></h2>

					<xsl:apply-templates />
				</div></a>
			</xsl:for-each>

			<xsl:for-each select="nonfiction">
				<a name="nonfic"><div class="project">
					<h2>Nonfiction</h2>

					<p>I'm not going to bother comparing these books to each other. I'll just say that I found each worth reading.</p>

					<xsl:apply-templates />
				</div></a>
			</xsl:for-each>

			<!--xsl:for-each select="notsofavs">
				<a name="notso"><div class="project">
					<h2>Not-so-favorites</h2>

					<xsl:for-each select="author">
						<p><b><xsl:value-of select="@name"/></b><br/>
						<xsl:apply-templates/></p>
					</xsl:for-each>
				</div></a>
			</xsl:for-each-->

			<div class="summary">
				<b><u>Geek Corner</u></b>: This page is generated using XSLT. <a href="xml/">See how</a>.
			</div>
		</body>
	</html>
</xsl:template>

<xsl:template match="author">
	<hr/>
	<p><b><xsl:choose>
		<xsl:when test="url">
			<a href="{url}"><xsl:value-of select="@name"/></a>
		</xsl:when>
		<xsl:when test="markedup">
			<xsl:apply-templates select="markedup"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="@name"/>
		</xsl:otherwise>
	</xsl:choose></b>
	<xsl:for-each select="book">
		<xsl:choose>
		<xsl:when test="readingNow"/>
		<xsl:otherwise>
		<a name="{@title}">
		<table><tr><td><img src="img/{@rating}.png" alt="{@rating}"/></td>
		<td><b><i><xsl:choose>
			<xsl:when test="url">
				<a href="{url}"><xsl:value-of select="@title"/></a>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="@title"/>
			</xsl:otherwise>
		</xsl:choose></i></b>
		<xsl:for-each select="comment">
			<xsl:apply-templates />
		</xsl:for-each>
		<xsl:for-each select="log">
			<a href="bookLog.html#{../@title}"><img border="0" src="img/entry.png"/></a>
		</xsl:for-each>
		</td></tr></table>
		</a>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:for-each>
	</p>
</xsl:template>

<xsl:template match="i">
	<i><xsl:apply-templates /></i>
</xsl:template>

<xsl:template match="a">
	<a href="{@href}"><xsl:apply-templates /></a>
</xsl:template>

</xsl:stylesheet>