<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:output method="html"/>
	<xsl:template match="/">
		<h3>Prologue - Vaughan edition</h3>
		<br/>
		<br/>
		<table>
			<xsl:for-each select="section/line">
				<tr>
					<td width="30px">
						<!-- if a footnote, then a number -->
						<xsl:choose>
							<xsl:when test="footnote">
								<xsl:value-of select="position()"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text> </xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</td>
					<td width="500px">
						<xsl:for-each select="unit">
							<xsl:choose>
								<xsl:when test="@oldReading = 'false' ">
									<!-- /// Special printing styles ////////// -->
									<xsl:choose>
										<xsl:when test="@special= 'italic'  ">
											<span class="italic">
												<xsl:value-of select="@value"/>
											</span>
										</xsl:when>
										<xsl:when test="@value= 'Xmt' ">
											<xsl:text> </xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="@value"/>
										</xsl:otherwise>
									</xsl:choose>
									<!-- //// Space //////////  -->
									<xsl:if test="@space = 'yes' ">
										<xsl:text> </xsl:text>
									</xsl:if>
								</xsl:when>
								<xsl:when test="@oldReading = 'null' ">
									<!-- /// Special printing styles ////////// -->
									<xsl:choose>
										<xsl:when test="@special= 'italic'  ">
											<span class="italic">
												<xsl:value-of select="@value"/>
											</span>
										</xsl:when>
										<xsl:when test="@value= 'Xmt' ">
											<xsl:text> </xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="@value"/>
										</xsl:otherwise>
									</xsl:choose>
									<!-- //// Space //////////  -->
									<xsl:if test="@space = 'yes' ">
										<xsl:text> </xsl:text>
									</xsl:if>
								</xsl:when>
							</xsl:choose>
						</xsl:for-each>
					</td>
					<!-- Words in a Line -->
					<!-- Spin through gloss terms -->
					<td style="width: 500px">
						<xsl:for-each select="unit">
							<xsl:if test="  @oldReading = 'false' ">
								<xsl:if test="@glossterm != 'null'">
									<xsl:value-of select="@glossterm"/>
									<xsl:text> </xsl:text>
								</xsl:if>
							</xsl:if>
							<xsl:if test=" @oldReading = 'null' ">
								<xsl:if test="@glossterm != 'null'">
									<xsl:value-of select="@glossterm"/>
									<xsl:text> </xsl:text>
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<br/>
		<br/>
		<!-- Footnotes -->
		<h3>Notes</h3>
		<xsl:for-each select="section/line">
			<xsl:if test="footnote">
				<span style="font-weight: bold">Footnote <xsl:value-of select="position()"/>:</span>
				<br/>
				<xsl:for-each select="footnote">
					<span style="font-style:italic">
						<xsl:value-of select="@footNoteAuthor"/>
					</span>
					<p>
						<xsl:value-of select="footNoteLine"/>
					</p>
				</xsl:for-each>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
