<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
	<xsl:param name="IDstart">A</xsl:param>
	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="//person[@id=$IDstart]">
				<xsl:call-template name="personTable">
					<xsl:with-param name="personID" select="$IDstart"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<p>Sorry, no person was found with id number <xsl:value-of select="$IDstart"/>.</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="//person[@id=$personID]">
			<table cellpadding="0px">
				<tr>
					<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"/>
						<xsl:call-template name="links"/>
					</td>
					<xsl:if test="partner">
						<td>
							<table cellpadding="0px">
								<xsl:for-each select="partner">
									<tr>
										<xsl:variable name="DOA1"><xsl:if test="./died">deceased</xsl:if></xsl:variable>
										<td class="{@sex} {$DOA1}">
											<xsl:call-template name="personHeader"/>
											<xsl:call-template name="images"/>
											<xsl:call-template name="links"/>
										</td>
										<xsl:if test="children">
											<td>
												<table>
													<xsl:for-each select="children/child">
														<tr>
															<td>
																<xsl:call-template name="personTable">
																	<xsl:with-param name="personID" select="@idRef"/>
																</xsl:call-template>
															</td>
														</tr>
													</xsl:for-each>
												</table>
											</td>
										</xsl:if>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</xsl:if>
				</tr>
			</table>
		</xsl:for-each>
	</xsl:template>
	<xsl:include href="common.xsl"/>
</xsl:stylesheet>

