<?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="20px">
						<!-- 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">
							<!-- glossterm -->
							<xsl:variable name="thisGlossTerm">
								<xsl:choose>
									<xsl:when test="@glossterm != 'null'">
										<xsl:value-of select="@glossterm"/>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select=" 'null' "/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<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>
					<!-- Line -->
				</tr>
			</xsl:for-each>
		</table>
		<br></br>
		<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></br>
			<xsl:for-each select="footnote">
					<span style="font-style:italic">
						<xsl:value-of select="@footNoteAuthor"></xsl:value-of>
					</span>
					<p>
						<xsl:value-of select="footNoteLine"></xsl:value-of>
					</p>			
			</xsl:for-each>	
			</xsl:if>
		</xsl:for-each>	
	</xsl:template>
</xsl:stylesheet>
