<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
	<xsl:param name="IDstart">C1232225</xsl:param>
	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="//person[@id=$IDstart]">
				<table cellpadding="0px">
					<tr>
						<xsl:call-template name="personTable">
							<xsl:with-param name="personID" select="$IDstart"/>
						</xsl:call-template>
					</tr>
				</table>
			</xsl:when>
			<xsl:otherwise>
				<p>Sorry, no person was found with that id number.</p>
				<p>Please click the browser's back button and try again.</p>
				<p>Hint: the Search-by-Name box on the home page might help.</p>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="personTable">
		<xsl:param name="personID"/>
		<xsl:for-each select="//child[@idRef=$personID]">
			<!-- reiterate back to father -->
			<xsl:call-template name="personTable">
				<xsl:with-param name="personID" select="../../../@id"/>
			</xsl:call-template>
		</xsl:for-each>
		<xsl:for-each select="//person[@id=$personID]">
			<xsl:variable name="DOA"><xsl:if test="./died">deceased</xsl:if></xsl:variable>
			<td class="{@sex} {$DOA}">
				<xsl:call-template name="personHeader"/>
				<xsl:call-template name="images"/>
			</td>
		</xsl:for-each>
	</xsl:template>
	<xsl:include href="common.xsl"/>
</xsl:stylesheet>

