<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" />

<xsl:template match="index">
	<html><head>
			<title>Imperatives of Jesus: Luke</title>
			<style type="text/css">tr.alignedTR {vertical-align: top}</style>
 		</head>
 	<body><xsl:call-template name="table"/></body>
 	</html>
</xsl:template>

<xsl:template match="index" mode="noheader">
	<xsl:call-template name="table"/>
</xsl:template>

<xsl:template name="table">
	<table border="0"><tr>
		<th>Reference</th>
		<th>Description</th>
		<th>Verse</th>
		<th>Scope</th>
		<th>To</th>
		</tr>
		<xsl:apply-templates/>
	</table>
</xsl:template>

<xsl:template match="item">
	<xsl:variable name="ref" select="@ref"/>
	<xsl:variable name="scope" select="@scope"/>
	<xsl:variable name="to" select="@to"/>
	<xsl:variable name="versetext" select="@versetext"/>
	<xsl:variable name="qaa">""''</xsl:variable>	
	<xsl:variable name="placement" select="comment/@placement"/>
	<xsl:variable name="precomment">
		<xsl:choose>
			<xsl:when test="@implicit and string(comment/@placement) = 'before'">
				(<em>implicit;&#xa0;<xsl:value-of select="comment"/></em>)&#xa0;
			</xsl:when>
			<xsl:when test="@implicit">
				(<em>implicit</em>)&#xa0;
			</xsl:when>
			<xsl:when test="string(comment/@placement) = 'before'">
				(<em><xsl:value-of select="comment"/></em>)&#xa0;
			</xsl:when>
		</xsl:choose>
	</xsl:variable>
	<tr class="alignedTR">
		<td><a href="http://www.gnpcb.org/esv/search/?q={$ref}"><xsl:value-of select="$ref"/></a></td>
		<td><xsl:value-of select="@description"/></td>
		<td>
		<xsl:choose>
			<xsl:when test="@implicit and string(comment/@placement) = 'before'">
				(<em>implicit;&#xa0;<xsl:value-of select="comment"/></em>)&#xa0;
			</xsl:when>
			<xsl:when test="@implicit">
				(<em>implicit</em>)&#xa0;
			</xsl:when>
			<xsl:when test="string(comment/@placement) = 'before'">
				(<em><xsl:value-of select="comment"/></em>)&#xa0;
			</xsl:when>
		</xsl:choose>
		<!-- replace fancy quotes with stupid ones, to match my stupidity about how this works -->
		<xsl:value-of select="translate($versetext,'&#8220;&#8221;&#8216;&#8217;',$qaa)"/>
		<!--	<xsl:value-of select="$versetext"/> -->
		<xsl:if test="string(comment/@placement) = 'after' ">(<em><xsl:value-of select="comment"/></em>)</xsl:if>
		</td>
		<td><xsl:value-of select="$scope"/></td>
		<td><xsl:value-of select="$to"/></td>
	</tr>
</xsl:template>

</xsl:stylesheet>
