<?xml version="1.0" encoding="UTF-8"?>
<!--

Stylesheet for common blocks templates
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:urn="urn:hl7-org:v3" xmlns:ext="urn:hl7-EE-DL-Ext:v1">
	<!--
Template for patient general info
	-->
	<xsl:template name="patientRole" match="urn:patientRole" mode="epicrises">
		<table width="100%">
			<tr>
				<td colspan="4" class="blockLabel">Patsient</td>
			</tr>
			<xsl:apply-templates select="urn:patient"/>
			<p/>
			<xsl:if test="urn:addr">
				<tr>
					<td class="rowTitle" width="15%">Elukoht</td>
					<td class="rowValue" colspan="3">
						<xsl:apply-templates select="urn:addr"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:telecom">
				<tr>
					<td colspan="4">
						<xsl:call-template name="telecomFormat"/>
					</td>
				</tr>
			</xsl:if>
			<!--Töökoht-->
			<xsl:if test="urn:patient/ext:patientPerson/ext:asEmployment">
				<xsl:for-each select="urn:patient/ext:patientPerson/ext:asEmployment">
					<xsl:call-template name="job"/>
				</xsl:for-each>
			</xsl:if>
			<!--Õppeasutus-->
			<xsl:if test="urn:patient/ext:patientPerson/ext:asStudent">
				<xsl:for-each select="urn:patient/ext:patientPerson/ext:asStudent">
					<xsl:call-template name="student"/>
				</xsl:for-each>
			</xsl:if>
			<!-- contacts -->
			<xsl:if test="//urn:participant[@typeCode='NOT']/urn:associatedEntity">
				<tr>
					<td colspan="4">
						<xsl:call-template name="contacts"/>
					</td>
				</tr>
			</xsl:if>
			<!-- haridus-->
			<xsl:if test="urn:patient/ext:patientPerson/ext:educationLevelCode">
				<tr>
					<td class="rowTitle" width="15%">Haridus</td>
					<td class="rowValue" colspan="3">
						<xsl:apply-templates select="urn:patient/ext:patientPerson/ext:educationLevelCode/@displayName"/>
					</td>
				</tr>
			</xsl:if>
			<!-- sotsiaalmajanduslik seisund-->
			<xsl:if test="substring(urn:patient/ext:patientPerson/ext:asMember/ext:groupEntity/ext:id/@root,1,25)='1.3.6.1.4.1.28284.6.2.3.9'">
				<tr>
					<td class="rowTitle" width="15%">Sotsiaalmajanduslik seisund</td>
					<td class="rowValue" colspan="3">
						<xsl:apply-templates select="urn:patient/ext:patientPerson/ext:asMember/ext:groupEntity/ext:id[substring(@root,1,25)='1.3.6.1.4.1.28284.6.2.3.9']/@assigningAuthorityName"/>
					</td>
				</tr>
			</xsl:if>
			<!-- rahvus-->
			<xsl:if test="urn:patient/urn:ethnicGroupCode">
				<tr>
					<td class="rowTitle" width="15%">Rahvus</td>
					<td class="rowValue" colspan="3">
						<xsl:apply-templates select="urn:patient/urn:ethnicGroupCode/@displayName"/>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--
Template for patientAge info
	-->
	<xsl:template name="section.patientAge" match="urn:section" mode="age">
		<table width="100%">
			<tr>
				<td class="rowTitle" width="15%">Vanus</td>
				<td class="rowValue">
					<xsl:choose>
						<xsl:when test="urn:text/@styleCode='xformatted'">
							<xsl:apply-templates select="urn:text" mode="row"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:if test="urn:entry/urn:observation/urn:value[@unit='y']">
								<xsl:value-of select="urn:entry/urn:observation/urn:value[@unit='y']/@value"/>
								<xsl:choose>
									<xsl:when test="urn:entry/urn:observation/urn:value[@unit='y']/@value='1'">
										<xsl:text> aasta </xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text> aastat </xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:if>
							<xsl:if test="urn:entry/urn:observation/urn:value[@unit='mo']">
								<xsl:value-of select="urn:entry/urn:observation/urn:value[@unit='mo']/@value"/>
								<xsl:choose>
									<xsl:when test="urn:entry/urn:observation/urn:value[@unit='mo']/@value='1'">
										<xsl:text> kuu </xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text> kuud </xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:if>
							<xsl:if test="urn:entry/urn:observation/urn:value[@unit='d']">
								<xsl:value-of select="urn:entry/urn:observation/urn:value[@unit='d']/@value"/>
								<xsl:choose>
									<xsl:when test="urn:entry/urn:observation/urn:value[@unit='d']/@value='1'">
										<xsl:text> päev </xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text> päeva </xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:if>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for persons personal info
	-->
	<xsl:template name="patient" match="urn:patient">
		<xsl:if test="../urn:id/@root='1.3.6.1.4.1.28284.6.2.2.1' or urn:id/@root='1.3.6.1.4.1.28284.6.2.2.1'">
			<tr>
				<td class="rowTitle" width="15%">Isikukood</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="../urn:id/@extension"/>
					<xsl:value-of select="urn:id/@extension"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="substring(../urn:id/@root,1,26)='1.3.6.1.4.1.28284.6.2.2.16' or substring(urn:id/@root,1,26)='1.3.6.1.4.1.28284.6.2.2.16'">
			<tr>
				<td class="rowTitle" width="15%">Välisriigi isikukood</td>
				<td>
					<span class="rowValue" colspan="3">
						<xsl:value-of select="../urn:id/@extension"/>
						<xsl:value-of select="urn:id/@extension"/>
					</span>
					<xsl:text> </xsl:text>
					<span class="rowTitle">OID</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="../urn:id/@root"/>
						<xsl:value-of select="urn:id/@root"/>
					</span>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="substring(../urn:id/@root,1,25)='1.3.6.1.4.1.28284.6.2.4.7' or substring(urn:id/@root,1,25)='1.3.6.1.4.1.28284.6.2.4.7'">
			<tr>
				<td class="rowTitle" width="15%">Tundmatu isiku kood</td>
				<td>
					<span class="rowValue" colspan="3">
						<xsl:value-of select="../urn:id/@extension"/>
						<xsl:value-of select="urn:id/@extension"/>
					</span>
					<xsl:text> </xsl:text>
					<span class="rowTitle">OID</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="../urn:id/@root"/>
						<xsl:value-of select="urn:id/@root"/>
					</span>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:name">
			<tr>
				<td class="rowTitle" width="15%">Eesnimi</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:name/urn:given"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" width="15%">Perekonnanimi</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:name/urn:family"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:birthTime">
			<tr>
				<td class="rowTitle" width="15%">Sünniaeg</td>
				<td class="rowValue" colspan="3">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:birthTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" width="15%">Sugu</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:administrativeGenderCode/@displayName"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:birthplace/urn:place/urn:addr">
			<tr>
				<td class="rowTitle" width="15%">Sünnikoht</td>
				<td class="rowValue" colspan="3">
					<xsl:apply-templates select="urn:birthplace/urn:place/urn:addr"/>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--
Template for deceasedTime
	-->
	<xsl:template name="deceasedTime" match="urn:patientRole" mode="deceasedTime">
		<!-- surma kuupäev-->
		<td class="rowTitle">Surma kuupäev</td>
		<td class="rowValue">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:patient/ext:patientPerson/ext:deceasedTime/@value"/>
				<xsl:with-param name="format" select="'time'"/>
			</xsl:call-template>
		</td>
	</xsl:template>
	<!--Template for job
-->
	<xsl:template name="job">
		<xsl:if test="ext:employerOrganization/ext:name">
			<tr>
				<td class="rowTitle" width="15%">Töökoht</td>
				<td class="rowValue">
					<xsl:value-of select="ext:employerOrganization/ext:name"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="ext:jobCode">
			<tr>
				<td class="rowTitle" width="15%">Amet</td>
				<td class="rowValue">
					<xsl:value-of select="ext:jobCode[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.3.1']/@displayName"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="ext:employerOrganization/ext:desc">
			<tr>
				<td class="rowTitle" width="15%">Töötinigmuste kirjeldus</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="ext:employerOrganization/ext:desc"/>
				</td>
			</tr>
		</xsl:if>
		<!--Töökoha ohutegurid-->
		<xsl:if test="ext:employerOrganization/ext:riskCode">
			<tr>
				<td class="rowTitle" width="15%">Töökoha riskitegurid</td>
				<td colspan="3">
					<table>
						<xsl:for-each select="ext:employerOrganization/ext:riskCode">
							<tr>
								<td class="rowValue">
									<xsl:value-of select="@code"/>
									<xsl:text> - </xsl:text>
									<xsl:value-of select="@displayName"/>
								</td>
								<xsl:if test="ext:originalText">
									<td class="rowTitle">Kirjeldus</td>
									<td class="rowValue">
										<xsl:value-of select="ext:originalText"/>
									</td>
								</xsl:if>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--Template for student
-->
	<xsl:template name="student">
		<tr>
			<td class="rowTitle" width="15%">Õppeasutus</td>
			<td class="rowValue">
				<xsl:value-of select="ext:schoolOrganization/ext:name"/>
			</td>
		</tr>
		<xsl:if test="ext:addr">
			<tr>
				<td class="rowTitle" width="15%">Aadress</td>
				<td class="rowValue">
					<xsl:apply-templates select="ext:addr"/>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--
	Template for baseURL info
	-->
	<xsl:template name="participant.baseURL" match="urn:associatedEntity" mode="baseURL">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">Pilidhoidla tehniline baasurl</td>
			</tr>
			<tr>
				<td class="rowTitle">Tehniline baasurl</td>
				<td class="rowValue">
					<table>
						<xsl:for-each select="urn:telecom">
							<tr>
								<td>
									<xsl:value-of select="@value"/>
								</td>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Pildihoidla kood</td>
				<td class="rowValue">
					<xsl:value-of select="urn:scopingOrganization/urn:id/@extension"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Pildihoidla nimetus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:scopingOrganization/urn:name"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Kontaktkoordinaadid</td>
				<td class="rowValue">
					<table>
						<xsl:for-each select="urn:scopingOrganization/urn:telecom">
							<tr>
								<td>
									<xsl:value-of select="@value"/>
								</td>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for persons contacts
	-->
	<xsl:template name="contacts">
		<table>
			<tr>
				<td colspan="8" class="blockLabel">Kontaktisikud</td>
			</tr>
			<tr class="rowTitle">
				<th>Nimi</th>
				<th>Isikukood</th>
				<th>Seos patsiendiga </th>
				<th>Kontaktid</th>
				<xsl:if test="//urn:participant[@typeCode='NOT']/urn:associatedEntity/urn:scopingOrganization">
					<th>Asutuse registrikood</th>
					<th>Nimetus</th>
					<th>Aadress</th>
					<th>Kontaktid</th>
				</xsl:if>
			</tr>
			<xsl:for-each select="//urn:participant[@typeCode='NOT']/urn:associatedEntity">
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:apply-templates select="urn:associatedPerson/urn:name"/>
						&#160;
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:id/@extension"/>
						&#160;	
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/@displayName"/>
						&#160;	
					</td>
					<td class="dataTableCell">
						<xsl:call-template name="telecomCellFormat"/>
					&#160;			
					</td>
					<xsl:if test="urn:scopingOrganization">
						<xsl:for-each select="urn:scopingOrganization">
							<td class="dataTableCell">
								<xsl:apply-templates select="urn:id/@extension"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:name"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:apply-templates select="urn:addr[@use='PHYS']"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="telecomCellFormat"/>
								&#160;	
							</td>
						</xsl:for-each>
					</xsl:if>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	Template for b.father
	-->
	<xsl:template name="bFather" match="urn:associatedEntity" mode="bFather">
		<table>
			<tr>
				<td class="blockLabel">Bioloogiline isa</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Nimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:associatedPerson/urn:name"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Sünniaeg</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:associatedPerson/ext:patientPerson/ext:birthTime/@value"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
			<xsl:if test="urn:addr">
				<tr>
					<td>
						<span class="rowTitle">Elukoht</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="urn:addr[@use='PHYS']"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:telecom[substring(@value,1,4)='tel:']">
				<tr>
					<td>
						<span class="rowTitle">Telefon</span>
						<span class="rowValue">
							<table>
								<xsl:for-each select="urn:telecom[substring(@value,1,4)='tel:']">
									<tr>
										<xsl:value-of select="substring(@value, 5)"/>
									</tr>
								</xsl:for-each>
							</table>
						</span>
					</td>
				</tr>
			</xsl:if>
			<!--Töökoht-->
			<xsl:if test="urn:associatedPerson/ext:patientPerson/ext:asEmployment">
				<xsl:for-each select="urn:associatedPerson/ext:patientPerson/ext:asEmployment">
					<tr>
						<td>
							<xsl:call-template name="job"/>
						</td>
					</tr>
				</xsl:for-each>
			</xsl:if>
			<!--Õppeasutus-->
			<xsl:if test="urn:associatedPerson/ext:patientPerson/ext:asStudent">
				<xsl:for-each select="urn:associatedPerson/ext:patientPerson/ext:asStudent">
					<tr>
						<td>
							<xsl:call-template name="student"/>
						</td>
					</tr>
				</xsl:for-each>
			</xsl:if>
			<!--Veregrupp ja Rh-->
			<tr>
				<td>
					<table>
						<!--Veregrupp-->
						<tr>
							<td class="rowTitle">Veregrupp</td>
							<td class="rowValue">
								<xsl:value-of select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation/ext:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/@displayName"/>
							</td>
							<xsl:if test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/ext:effectiveTime">
								<td class="rowTitle">määramise kuupäev</td>
								<td class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/ext:effectiveTime/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</td>
							</xsl:if>
							<xsl:choose>
								<xsl:when test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/ext:author">
									<td>
										<xsl:for-each select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']">
											<xsl:call-template name="EXTtimeCriticalSourceAuthor">
												<xsl:with-param name="tabel" select="'Ei'"/>
											</xsl:call-template>
										</xsl:for-each>
									</td>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/ext:reference/ext:externalDocument">
										<td>
											<xsl:for-each select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']">
												<xsl:call-template name="EXTtimeCriticalSourceAuthor">
													<xsl:with-param name="tabel" select="'Ei'"/>
												</xsl:call-template>
											</xsl:for-each>
										</td>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</tr>
						<!--Rh-->
						<tr>
							<td class="rowTitle">Rh</td>
							<td class="rowValue">
								<xsl:value-of select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation/ext:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/@displayName"/>
							</td>
							<xsl:if test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/ext:effectiveTime">
								<td class="rowTitle">määramise kuupäev</td>
								<td class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/ext:effectiveTime/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</td>
							</xsl:if>
							<xsl:choose>
								<xsl:when test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/ext:author">
									<td>
										<xsl:for-each select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']">
											<xsl:call-template name="EXTtimeCriticalSourceAuthor">
												<xsl:with-param name="tabel" select="'Ei'"/>
											</xsl:call-template>
										</xsl:for-each>
									</td>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/ext:reference/ext:externalDocument">
										<td>
											<xsl:for-each select="urn:associatedPerson/ext:asObserved/ext:procedure/ext:targetOf/ext:observation[substring(ext:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']">
												<xsl:call-template name="EXTtimeCriticalSourceAuthor">
													<xsl:with-param name="tabel" select="'Ei'"/>
												</xsl:call-template>
											</xsl:for-each>
										</td>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</tr>
					</table>
				</td>
			</tr>
			<!--Eelnevalt diagnoositud kroonilised haigused-->
			<xsl:if test="urn:associatedPerson/ext:asObserved/ext:observation/ext:code/@code='DGN'">
				<tr>
					<td class="blockLabel">Bioloogilise isa eelnevalt diagnoositud kroonilised haigused</td>
				</tr>
				<tr>
					<td>
						<table>
							<xsl:for-each select="urn:associatedPerson/ext:asObserved/ext:observation[ext:code/@code='DGN']">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:value-of select="ext:value"/>
									</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
				</tr>
			</xsl:if>
			<!--Lisateave tervise ohutegurite kohta-->
			<xsl:if test="urn:associatedPerson/ext:patientPerson/ext:riskCode">
				<tr>
					<td class="blockLabel">Lisateave tervise ohutegurite kohta</td>
				</tr>
				<xsl:for-each select="urn:associatedPerson/ext:patientPerson/ext:riskCode">
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="@displayName"/>
							</span>
							<xsl:text>  </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="ext:originalText"/>
							</span>
						</td>
					</tr>
				</xsl:for-each>
			</xsl:if>
		</table>
	</xsl:template>
	<!--

	Template for persons guardians
	-->
	<xsl:template name="guardians" match="urn:patient" mode="guardian">
		<table>
			<tr>
				<td colspan="8" class="blockLabel">Muu osaleja haigusjuhtumis või ravijuhtumis (eestkostja)</td>
			</tr>
			<tr class="rowTitle">
				<th>Nimi</th>
				<th>Isikukood</th>
				<th>Seos patsiendiga</th>
			</tr>
			<xsl:for-each select="urn:guardian">
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:apply-templates select="urn:guardianPerson/urn:name"/>
						&#160;	
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:id/@extension"/>
						&#160;	
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/@displayName"/>
						&#160;	
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
Template for patient general info - pension
	-->
	<xsl:template name="patient.pension" match="ext:asOtherIDs" mode="pension">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">Riiklik pension</td>
			</tr>
			<tr>
				<td class="rowTitle">Pensionitunnistuse number</td>
				<td class="rowValue">
					<xsl:value-of select="ext:id[@root='1.3.6.1.4.1.28284.6.2.4.33']/@extension"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Pensioni liik</td>
				<td class="rowValue">
					<xsl:value-of select="ext:id[substring(@root,1,26)='1.3.6.1.4.1.28284.6.2.3.14']/@assigningAuthorityName"/>
				</td>
			</tr>
			<xsl:for-each select="ext:scopingOrganization">
				<tr>
					<td colspan="2" class="rowTitle">Pensioni väljastaja</td>
				</tr>
				<tr>
					<td class="rowTitle">Registrikood</td>
					<td class="rowValue">
						<xsl:value-of select="ext:id/@extension"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">Nimi</td>
					<td class="rowValue">
						<xsl:value-of select="ext:name"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">Aadress</td>
					<td class="rowValue">
						<xsl:apply-templates select="ext:addr[@use='PHYS']"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
Template for patient timecritical info
	-->
	<xsl:template name="patient.timecritical" match="urn:patient" mode="timecritical">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">Patsient</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Eesnimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:name/urn:given"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Perekonnanimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:name/urn:family"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="../urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Sünniaeg</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:birthTime/@value"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
			<xsl:if test="ext:patientPerson/ext:disabilityCode">
				<tr>
					<td colspan="2">
						<span class="rowTitle">Teovõimelisus</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="ext:patientPerson/ext:disabilityCode/@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="../urn:addr">
				<tr>
					<td colspan="2">
						<span class="rowTitle">Elukoht</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="../urn:addr"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="../urn:telecom">
				<tr>
					<td>
						<span class="rowTitle">Telefon</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="substring(../urn:telecom[substring(@value,1,4)='tel:']/@value, 5)"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<!-- contacts -->
			<tr>
				<td>
					<xsl:call-template name="contacts"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for patient general info - stat
	-->
	<xsl:template name="patientRole.stat" match="urn:patientRole" mode="stat">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">Patsient</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Sugu</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:patient/urn:administrativeGenderCode/@displayName"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Sünniaeg</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:patient/urn:birthTime/@value"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Elukoht</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:addr[@use='PHYS']"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for patient general info - application
	-->
	<xsl:template name="patientRole.application" match="urn:patientRole" mode="application">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">Patsient</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Eesnimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:patient/urn:name/urn:given"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Perekonnanimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:patient/urn:name/urn:family"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id/@extension"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for trustPerson general info - trustPerson
	-->
	<xsl:template name="guardian.trustPerson" match="urn:guardian" mode="trustPerson">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">Usaldusisik</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Eesnimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:guardianPerson/urn:name/urn:given"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Perekonnanimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:guardianPerson/urn:name/urn:family"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.2.1']/@extension"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for applicationAuthor
	-->
	<xsl:template name="applicationAuthor" match="urn:assignedAuthor" mode="applicationAuthor">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">Volitaja</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Eesnimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:assignedPerson/urn:name/urn:given"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<span class="rowTitle">Perekonnanimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:assignedPerson/urn:name/urn:family"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Isikukood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.2.1']/@extension"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for patient general info - child
	-->
	<xsl:template name="patient.child" match="urn:patient" mode="child">
		<xsl:if test="../../urn:realmCode[@code='PAT']">
			<table>
				<tr>
					<td colspan="4" class="blockLabel">Vastsündinu</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Eesnimi</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:name/urn:given"/>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Perekonnanimi</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:name/urn:family"/>
						</span>
					</td>
				</tr>
				<tr>
					<td>
						<span class="rowTitle">Sugu</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:administrativeGenderCode/@displayName"/>
						</span>
					</td>
					<td>
						<span class="rowTitle">Isikukood</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="../urn:id/@extension"/>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Sünniaeg</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:birthTime/@value"/>
							</xsl:call-template>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Elukoht</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="../urn:addr"/>
						</span>
					</td>
				</tr>
			</table>
		</xsl:if>
	</xsl:template>
	<!--
Template for patient general info - mother
	-->
	<xsl:template name="patient.mother" match="urn:patient" mode="mother">
		<xsl:if test="../../urn:realmCode[@code='GUARD']">
			<table>
				<tr>
					<td colspan="4" class="blockLabel">Ema</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Eesnimi</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:name/urn:given"/>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Perekonnanimi</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:name/urn:family"/>
						</span>
					</td>
				</tr>
				<tr>
					<td>
						<span class="rowTitle">Isikukood</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="../urn:id/@extension"/>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Sünniaeg</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:birthTime/@value"/>
							</xsl:call-template>
						</span>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<span class="rowTitle">Elukoht</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="../urn:addr"/>
						</span>
					</td>
				</tr>
			</table>
		</xsl:if>
	</xsl:template>
	<!--
Template for patient practitioner
	-->
	<xsl:template name="providerOrganization" match="ext:providerOrganization" mode="practitioner">
		<table>
			<tr>
				<td colspan="6" class="blockLabel">Perearst</td>
			</tr>
			<xsl:if test="ext:contactParty/ext:contactPerson/ext:name">
				<tr>
					<td colspan="6">
						<span class="rowTitle">Nimi</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="ext:contactParty/ext:contactPerson/ext:name"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td colspan="6">
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="ext:contactParty/ext:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="ext:name">
				<tr>
					<td colspan="6">
						<span class="rowTitle">Praksise nimetus</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="ext:name"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:id[@root='1.3.6.1.4.1.28284.4']">
				<tr>
					<td class="rowTitle" colspan="4">Praksise registrikood</td>
					<td class="rowValue">
						<xsl:value-of select="ext:id/@extension"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:for-each select="ext:contactParty">
				<xsl:if test="ext:addr">
					<tr>
						<td colspan="6">
							<table>
								<tr>
									<td class="blockLabel">Tegevuskoha aadressid</td>
								</tr>
								<xsl:for-each select="ext:addr">
									<tr class="rowValue">
										<td class="dataTableCell">
											<xsl:apply-templates select="."/>
										</td>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">Telefon</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="substring(ext:telecom[substring(@value,1,4)='tel:']/@value, 5)"/>
							</span>
						</td>
						<td>
							<span class="rowTitle">E-post</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="substring(ext:telecom[substring(@value,1,7)='mailto:']/@value, 8)"/>
							</span>
						</td>
						<td>
							<span class="rowTitle">Faks</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="substring(ext:telecom[substring(@value,1,4)='fax:']/@value,5)"/>
							</span>
						</td>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	template for free text blocks
	-->
	<xsl:template name="section.text" match="urn:section" mode="text">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowValue">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	template for free text blocks
	-->
	<xsl:template name="careEnd" match="urn:section" mode="careEndReason">
		<table>
			<tr>
				<td class="rowTitle">Ravi lõpetamise põhjus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:act/urn:reasonCode/@displayName"/>
				</td>
			</tr>
			<xsl:if test="urn:entry/urn:observation[urn:code/@code='90910008']">
				<tr>
					<td class="rowValue" colspan="2">
						<b>Saneeritud: </b>
						<xsl:apply-templates mode="negation" select="urn:entry/urn:observation[urn:code/@code='90910008']"/>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--

	Template for drug prescriptions
	-->
	<xsl:template name="section.drugs" match="urn:section" mode="drugs">
		<table>
			<tr>
				<td colspan="6" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<xsl:if test="urn:entry/urn:substanceAdministration/urn:id">
							<th>Retsepti nr.</th>
						</xsl:if>
						<xsl:if test="urn:entry/urn:substanceAdministration/urn:effectiveTime">
							<th>Ravimi väljastamise kuupäev</th>
						</xsl:if>
						<th>ATC kood</th>
						<th>Toimeaine nimetus</th>
						<th>Ravimvorm</th>
						<th>Ühekordne annus</th>
						<th>Manustamiskordi</th>
						<xsl:if test="urn:entry/urn:substanceAdministration/urn:entryRelationship/urn:supply/urn:expectedUseTime/urn:high/@value">
							<th>Retsept kehtiv kuni</th>
						</xsl:if>
						<xsl:if test="urn:entry/urn:substanceAdministration/urn:entry/urn:substanceAdministration/urn:author">
							<th>Allikas</th>
						</xsl:if>
					</tr>
					<xsl:for-each select="urn:entry/urn:substanceAdministration">
						<tr class="rowValue">
							<xsl:if test="urn:id">
								<td class="dataTableCell">
									<xsl:value-of select="urn:id/@extension"/>
								&#160;	
							</td>
							</xsl:if>
							<xsl:if test="urn:effectiveTime">
								<td class="dataTableCell">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
									</xsl:call-template>
								&#160;	
							</td>
							</xsl:if>
							<td class="dataTableCell">
								<xsl:value-of select="urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/@code"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/@displayName"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:administrationUnitCode/@displayName"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:doseQuantity/@value"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="urn:doseQuantity/@unit"/>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:rateQuantity/@value"/>
								<xsl:text> x </xsl:text>
								<xsl:call-template name="dateUnit">
									<xsl:with-param name="mode" select="'per'"/>
									<xsl:with-param name="unit" select="urn:rateQuantity/@unit"/>
								</xsl:call-template>
								&#160;	
							</td>
							<xsl:if test="urn:entryRelationship/urn:supply/urn:expectedUseTime/urn:high/@value">
								<td class="dataTableCell">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:entryRelationship/urn:supply/urn:expectedUseTime/urn:high/@value"/>
									</xsl:call-template>
								&#160;	
							</td>
							</xsl:if>
							<xsl:choose>
								<xsl:when test="urn:author">
									<td class="dataTableCell">
										<xsl:call-template name="timeCriticalSourceAuthor">
											<xsl:with-param name="tabel" select="'Jah'"/>
										</xsl:call-template>
										&#160;	
									</td>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="urn:reference/urn:externalDocument">
										<td class="dataTableCell">
											<xsl:call-template name="timeCriticalSourceAuthor">
												<xsl:with-param name="tabel" select="'Jah'"/>
											</xsl:call-template>
											&#160;	
										</td>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for procedures, surgery and tests
	-->
	<xsl:template name="procedures">
		<xsl:param name="dontShowText"/>
		<table>
			<tr>
				<td>
					<xsl:choose>
						<xsl:when test="$dontShowText">
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='STATPROC']" mode="statProcedures"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='PROC']" mode="procedures"/>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:choose>
						<xsl:when test="$dontShowText">
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='STSUR']" mode="statProcedures"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='SUR']" mode="surgery"/>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:choose>
						<xsl:when test="$dontShowText">
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='STANA']" mode="statProcedures"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='ANA']" mode="tests"/>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for procedures detail info
	-->
	<xsl:template name="section.procedures" match="urn:section" mode="procedures">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Kuupäev</th>
						<th>HK Hinnakirja kood</th>
						<th>Alternatiivkood</th>
					</tr>
					<xsl:for-each select="urn:entry/urn:procedure">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:apply-templates select="urn:code" mode="formatting"/>
								&#160;	
							</td>
							<!--alternatiivkoodid-->
							<td class="dataTableCell">
								<xsl:for-each select="urn:code/urn:translation">
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
								</xsl:for-each>
								&#160;	
							</td>
						</tr>
						<tr class="rowValue">
							<td class="dataTableCell" colspan="4">
								<xsl:value-of select="urn:text"/>
								<xsl:if test="urn:entryRelationship/urn:observationMedia/urn:value/urn:reference/@value">
									<br/>
									<xsl:text>Manus:</xsl:text>
									<b>
										<xsl:value-of select="urn:entryRelationship/urn:observationMedia/urn:value/urn:reference/@value"/>
									</b>
								</xsl:if>
								&#160;	
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for operations
	-->
	<xsl:template name="section.surgery" match="urn:section" mode="surgery">
		<table>
			<tr>
				<td colspan="6" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Kuupäev</th>
						<th>Operatsiooni koodid NCSP</th>
						<th>Alternatiivkood</th>
						<th>Anesteesia liik </th>
						<th>Lisavahendid</th>
						<th>Läbiviija</th>
					</tr>
					<xsl:for-each select="urn:entry/urn:procedure">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:for-each select="urn:code">
									<xsl:apply-templates select="." mode="formatting"/>
									<br/>
									<xsl:for-each select="urn:qualifier/urn:value">
										<xsl:apply-templates select="." mode="formatting"/>
										<br/>
									</xsl:for-each>
								</xsl:for-each>
								&#160;	
							</td>
							<!--alternatiivkoodid-->
							<td class="dataTableCell">
								<xsl:for-each select="urn:code/urn:translation">
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
									<br/>
								</xsl:for-each>
								&#160;	
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:methodCode/@displayName"/>
									&#160;	
								</td>
							<td class="dataTableCell">
								<xsl:for-each select="urn:entryRelationship/urn:supply">
									<xsl:apply-templates select="urn:code" mode="formatting"/>
									<br/>
								</xsl:for-each>
									&#160;	
								</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:performer[urn:modeCode/@code='SUR']/urn:assignedEntity/urn:id/@extension"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="urn:performer[urn:modeCode/@code='SUR']/urn:assignedEntity/urn:representedOrganization/urn:name"/>
									&#160;	
								</td>
						</tr>
						<tr class="rowValue">
							<td class="dataTableCell" colspan="6">
								<xsl:value-of select="urn:text"/>
								&#160;	
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for blood/Rh
	-->
	<xsl:template name="section.bloodRh" match="urn:section" mode="bloodRh">
		<table>
			<tr>
				<td class="blockLabel" colspan="3">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Veregrupp</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/@displayName"/>
				</td>
				<td class="rowTitle">määramise kuupäev</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/urn:effectiveTime/@value"/>
						<xsl:with-param name="format" select="'time'"/>
					</xsl:call-template>
				</td>
				<xsl:if test="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']/urn:author">
					<td>
						<xsl:for-each select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.29']">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:for-each>
					</td>
				</xsl:if>
			</tr>
			<tr>
				<td class="rowTitle">Rh</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/@displayName"/>
				</td>
				<td class="rowTitle">määramise kuupäev</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/urn:effectiveTime/@value"/>
						<xsl:with-param name="format" select="'time'"/>
					</xsl:call-template>
				</td>
				<xsl:if test="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']/urn:author">
					<td>
						<xsl:for-each select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.22']">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:for-each>
					</td>
				</xsl:if>
			</tr>
		</table>
	</xsl:template>
	<!--	

	Template for disability
	-->
	<xsl:template name="section.disability" match="urn:section" mode="disability">
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Puude raskusaste</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='DISABL']/urn:value/@displayName"/>
				</td>
				<td class="rowTitle">Kehtiv kuni</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='DISABL']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
				<xsl:if test="urn:entry/urn:observation[urn:code/@code='DISABL']/urn:author">
					<td>
						<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='DISABL']">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:for-each>
					</td>
				</xsl:if>
			</tr>
			<tr>
				<td class="rowTitle">Töövõimetuskaotuse %</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='WORKLOST']/urn:value/@value"/>
				</td>
				<td class="rowTitle">Kehtiv kuni</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='WORKLOST']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
				<xsl:if test="urn:entry/urn:observation[urn:code/@code='WORKLOST']/urn:author">
					<td>
						<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='WORKLOST']">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:for-each>
					</td>
				</xsl:if>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for pregnancy
	-->
	<xsl:template name="section.pregnancy" match="urn:section" mode="pregnancy">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Arvele võtmise kuupäev</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/@value"/>
						<xsl:with-param name="format" select="'time'"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Rasedusjuhtum</td>
				<td class="rowValue">
					<span>
						<xsl:apply-templates select="urn:entry/urn:encounter/urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="urn:entry/urn:encounter/urn:author">
				<tr>
					<td colspan="2">
						<xsl:for-each select="urn:entry/urn:encounter">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--	


	Template for prgnEncounter
	-->
	<xsl:template name="section.prgnEncounter" match="urn:section" mode="prgnEncounter">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Loote-ja sünnikahjustuse riskitegurid</td>
				<td class="rowValue">
					<xsl:value-of select="urn:text/urn:paragraph/urn:content"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Mitmes rasedus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='PRGNNR']/urn:value/@value"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Mitmes sünnitus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BIRTHNR']/urn:value/@value"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Gestatsiooniaeg nädalates</td>
				<td class="rowValue">
					<xsl:apply-templates select="urn:entry/urn:observation[urn:code/@code='PRGNWK']/urn:value/@value"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--	



Template for birthData
	-->
	<xsl:template name="section.birthData" match="urn:section" mode="birthData">
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Vastsündinu ajalisus</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BIRTH' or urn:code/@code='268477000']/urn:value/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BIRTH' or urn:code/@code='268477000']/urn:value/@displayName"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Sünnikaal</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='364589006' or urn:code/@code='363809009']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='364589006' or urn:code/@code='363809009']/urn:value/@unit"/>
					<xsl:text> </xsl:text>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='364589006' or urn:code/@code='363809009']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Pikkus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='LENGTH' or urn:code/@code='50373000']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='LENGTH' or urn:code/@code='50373000']/urn:value/@unit"/>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='LENGTH' or urn:code/@code='50373000']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Peaümbermõõt</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:value/@unit"/>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Rinnaümbermõõt</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BPM']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BPM']/urn:value/@unit"/>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='BPM']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Apgar 1 minutil</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='APGAR1']/urn:value/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='APGAR1']/urn:value/@displayName"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Apgar 5 minutil</td>
				<td class="rowValue" colspan="3">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='APGAR5']/urn:value/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='APGAR5']/urn:value/@displayName"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for pastPregnancy
	-->
	<xsl:template name="section.currentPregnancy2" match="urn:section" mode="pastPregnancy">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:encounter">
						<tr class="rowValue">
							<td class="dataTableCell">
								<table>
									<!--ühe raseduse andmed-->
									<tr>
										<td colspan="2">
											<xsl:call-template name="timeCriticalSourceAuthor">
												<xsl:with-param name="tabel" select="'Jah'"/>
											</xsl:call-template>
										</td>
									</tr>
									<!--lapse isikukood-->
									<xsl:if test="urn:subject/urn:relatedSubject/urn:code">
										<tr>
											<td class="rowTitle">Lapse isikukood</td>
											<td class="rowValue">
												<xsl:value-of select="urn:subject/urn:relatedSubject/urn:code/@code"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:for-each select="urn:entryRelationship/urn:observation">
										<!--sünniaasta-->
										<xsl:if test="urn:code/@code='184099003'">
											<tr>
												<td class="rowTitle">Sünniaasta</td>
												<td class="rowValue">
													<xsl:choose>
														<xsl:when test="string-length(urn:effectiveTime/@value)>4">
															<xsl:call-template name="dateFormat">
																<xsl:with-param name="date" select="urn:value/@value"/>
															</xsl:call-template>
														</xsl:when>
														<xsl:otherwise>
															<xsl:value-of select="urn:value/@value"/>
														</xsl:otherwise>
													</xsl:choose>
												</td>
											</tr>
										</xsl:if>
										<!--Lapse sugu-->
										<xsl:if test="urn:code/@code='281053000'">
											<tr>
												<td class="rowTitle">Lapse sugu</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value/@code"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="urn:value/@displayName"/>
												</td>
											</tr>
										</xsl:if>
										<!--Lapse kaal-->
										<xsl:if test="urn:code/@code='364589006'">
											<tr>
												<td class="rowTitle">Lapse kaal</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value/@value"/>
													<xsl:text> </xsl:text>
													<xsl:call-template name="dateUnit">
														<xsl:with-param name="unit" select="urn:value/@unit"/>
													</xsl:call-template>
												</td>
											</tr>
										</xsl:if>
										<!--Lapse pikkus-->
										<xsl:if test="urn:code/@code='50373000'">
											<tr>
												<td class="rowTitle">Lapse pikkus</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value/@value"/>
													<xsl:text> </xsl:text>
													<xsl:call-template name="dateUnit">
														<xsl:with-param name="unit" select="urn:value/@unit"/>
													</xsl:call-template>
												</td>
											</tr>
										</xsl:if>
										<!--Laps elab : jah/ei-->
										<xsl:if test="urn:code/@code='438949009' or urn:code/@code='419099009'">
											<tr>
												<td class="rowTitle">
													<xsl:value-of select="urn:code/@displayName"/>
												</td>
												<td class="rowValue"/>
											</tr>
										</xsl:if>
										<!--raseduse kulg-->
										<xsl:if test="urn:code/@code='289908002'">
											<tr>
												<td class="rowTitle">Raseduse kulg</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</tr>
										</xsl:if>
										<!--Sünnituse kulg ja tüsistused-->
										<xsl:if test="urn:code/@code='27541007'">
											<tr>
												<td class="rowTitle">Sünnituse kulg ja tüsistused</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</tr>
										</xsl:if>
										<!--sünnituse ajalisus-->
										<xsl:if test="urn:code/@code='268477000'">
											<tr>
												<td class="rowTitle">Sünnituse ajalisus</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value/@code"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="urn:value/@displayName"/>
												</td>
											</tr>
										</xsl:if>
										<!--Sünnitusjärgse perioodi kulg-->
										<xsl:if test="urn:code/@code='423991001'">
											<tr>
												<td class="rowTitle">Sünnitusjärgse perioodi kulg</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</tr>
										</xsl:if>
										<!--Imetamise kestvus-->
										<xsl:if test="urn:code/@code='169746009'">
											<tr>
												<td class="rowTitle">Imetamise kestvus</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</tr>
										</xsl:if>
										<!--Emakaväline rasedus-->
										<xsl:if test="urn:code/@code='34801009'">
											<tr>
												<td class="rowTitle">Emakaväline rasedus</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
													<br/>
													<xsl:if test="urn:effectiveTime">
														<xsl:text>Aeg: </xsl:text>
														<xsl:choose>
															<xsl:when test="string-length(urn:effectiveTime/@value)>4">
																<xsl:call-template name="dateFormat">
																	<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
																</xsl:call-template>
															</xsl:when>
															<xsl:otherwise>
																<xsl:value-of select="urn:effectiveTime/@value"/>
															</xsl:otherwise>
														</xsl:choose>
														<br/>
													</xsl:if>
												</td>
											</tr>
										</xsl:if>
										<!--Abort-->
										<xsl:if test="urn:code/@code='267014009'">
											<tr>
												<td class="rowTitle">Abort</td>
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
													<br/>
													<xsl:if test="urn:effectiveTime">
														<xsl:text>Aeg: </xsl:text>
														<xsl:choose>
															<xsl:when test="string-length(urn:effectiveTime/@value)>4">
																<xsl:call-template name="dateFormat">
																	<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
																</xsl:call-template>
															</xsl:when>
															<xsl:otherwise>
																<xsl:value-of select="urn:effectiveTime/@value"/>
															</xsl:otherwise>
														</xsl:choose>
														<br/>
													</xsl:if>
													<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='366323009'">
														<xsl:text>Rasedusnädal: </xsl:text>
														<xsl:value-of select="urn:entryRelationship/urn:observation/urn:value/@value"/>
													</xsl:if>
												</td>
											</tr>
										</xsl:if>
									</xsl:for-each>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for pastPregnancyDL
	-->
	<xsl:template name="section.pregnancyDL" match="urn:section" mode="pregnancyDL">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:encounter">
						<!--ühe dokumendi andmed-->
						<tr class="rowValue">
							<td class="dataTableCell">
								<table>
									<xsl:if test="urn:id">
										<tr>
											<td class="rowTitle">Haigusjuhtumi number</td>
											<td>
												<xsl:value-of select="urn:id/@extension"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="urn:code">
										<tr>
											<td class="rowTitle">Haigusjuhtumi tüüp</td>
											<td>
												<xsl:value-of select="urn:code/@displayName"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="urn:subject/urn:relatedSubject/urn:code">
										<tr>
											<td class="rowTitle">Isikukood</td>
											<td>
												<xsl:value-of select="urn:subject/urn:relatedSubject/urn:code/@code"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="urn:reference/urn:externalDocument/urn:id">
										<tr>
											<td class="rowTitle">Dokumendi number</td>
											<td>
												<xsl:value-of select="urn:reference/urn:externalDocument/urn:id/@extension"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="urn:reference/urn:externalDocument/urn:code">
										<tr>
											<td class="rowTitle">Dokumendi tüüp</td>
											<td>
												<xsl:value-of select="urn:reference/urn:externalDocument/urn:code/@displayName"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="urn:entryRelationship/urn:observation">
										<tr>
											<td colspan="2">
												<xsl:call-template name="currentPregnancyDiagnose"/>
											</td>
										</tr>
									</xsl:if>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--		Template for currentPregnancyDiagnose
	-->
	<xsl:template name="currentPregnancyDiagnose">
		<table>
			<tr class="rowTitle">
				<th>Diagnoos</th>
				<th>Sõnaline diagnoos</th>
				<th>Diagnoosi statistiline liik</th>
			</tr>
			<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='DGN']">
				<tr>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/@code"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="urn:value/@displayName"/>
						<xsl:for-each select="urn:value/urn:translation">
							<xsl:apply-templates select="." mode="formatting">
								<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
							</xsl:apply-templates>
						</xsl:for-each>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/urn:originalText"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	Template for currentPregnancy
	-->
	<xsl:template name="section.currentPregnancy" match="urn:section" mode="currentPregnancy">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:encounter">
						<tr>
							<td colspan="2">
								<xsl:call-template name="timeCriticalSourceAuthor">
									<xsl:with-param name="tabel" select="'Jah'"/>
								</xsl:call-template>
							</td>
						</tr>
						<tr>
							<td class="rowTitle">Arvele võtmise kuupäev</td>
							<td class="rowValue">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
						</tr>
						<!--Rasedusnädal-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='366323009']">
							<tr>
								<td class="rowTitle">Rasedusnädal</td>
								<td class="rowValue">
									<xsl:for-each select="urn:value">
										<xsl:if test="@unit='wk'">
											<xsl:value-of select="@value"/>
										</xsl:if>
										<xsl:if test="@unit='d'">
											<xsl:text>+</xsl:text>
											<xsl:value-of select="@value"/>
										</xsl:if>
									</xsl:for-each>
								</td>
							</tr>
						</xsl:for-each>
						<!--menstruatsiooni regulaarsus-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='364307006']">
							<tr>
								<td class="rowTitle">Menstruatsiooni regulaarsus</td>
								<td class="rowValue">
									<xsl:value-of select="urn:value"/>
								</td>
							</tr>
						</xsl:for-each>
						<!--Tsükli pikkus-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='364310004']">
							<tr>
								<td class="rowTitle">Tsükli pikkus (päevades)</td>
								<td class="rowValue">
									<xsl:if test="urn:value/@value">
										<xsl:value-of select="urn:value/@value"/>
									</xsl:if>
									<xsl:if test="urn:value/urn:low or urn:value/urn:high">
										<xsl:value-of select="urn:value/urn:low/@value"/>
										<xsl:text> - </xsl:text>
										<xsl:value-of select="urn:value/urn:high/@value"/>
									</xsl:if>
								</td>
							</tr>
						</xsl:for-each>
						<!--Viimase menstruatsiooni algus-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='161713000']">
							<tr>
								<td class="rowTitle">Viimase menstruatsiooni algus</td>
								<td class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:value/@value"/>
									</xsl:call-template>
								</td>
							</tr>
						</xsl:for-each>
						<!--Menarche-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='398700009']">
							<tr>
								<td class="rowTitle">Menarche (vanus täisaastates)</td>
								<td class="rowValue">
									<xsl:value-of select="urn:value/@value"/>
								</td>
							</tr>
						</xsl:for-each>
						<!--Oletatav sünnitamise tähtaeg-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='161714006']">
							<tr>
								<td class="rowTitle">Oletatav sünnitamise tähtaeg</td>
								<td class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:value/@value"/>
									</xsl:call-template>
								</td>
							</tr>
						</xsl:for-each>
						<!--Naise kehakaal enne rasestumist-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='363809009']">
							<tr>
								<td class="rowTitle">Naise kehakaal enne rasestumist (kg)</td>
								<td class="rowValue">
									<xsl:value-of select="urn:value/@value"/>
								</td>
							</tr>
						</xsl:for-each>
						<!--Naise pikkus-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='50373000']">
							<tr>
								<td class="rowTitle">Naise pikkus enne rasestumist (cm)</td>
								<td class="rowValue">
									<xsl:value-of select="urn:value/@value"/>
								</td>
							</tr>
						</xsl:for-each>
						<!--KMI-->
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='60621009']">
							<tr>
								<td class="rowTitle">Kehamassi indeks enne rasestumist</td>
								<td class="rowValue">
									<xsl:value-of select="round((urn:value/urn:numerator/@value) div (urn:value/urn:denominator/@value))"/>
								</td>
							</tr>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for currentPregnancyEncounter 
	-->
	<xsl:template name="section.cuurentPregnancyEncounter" match="urn:section" mode="currentPregnancyEncounter">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:encounter">
						<!--ühe vastuvõtu andmed-->
						<tr class="rowValue">
							<td class="dataTableCell">
								<table>
									<tr>
										<td colspan="2">
											<xsl:call-template name="timeCriticalSourceAuthor">
												<xsl:with-param name="tabel" select="'Jah'"/>
											</xsl:call-template>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Vastuvõtu kuupäev</td>
										<td class="rowValue">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
											</xsl:call-template>
										</td>
									</tr>
									<!--rasedusnädal-->
									<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='57036006'">
										<tr>
											<td class="rowTitle">Rasedusnädal</td>
											<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='57036006']">
												<td class="rowValue">
													<xsl:value-of select="urn:value[@unit='wk']/@value"/>
													<xsl:if test="urn:value[@unit='d']">
														<xsl:text>+</xsl:text>
														<xsl:value-of select="urn:value[@unit='d']/@value"/>
													</xsl:if>
												</td>
											</xsl:for-each>
										</tr>
									</xsl:if>
									<!--kaebused-->
									<xsl:if test="urn:text">
										<tr>
											<td class="rowTitle">Kaebused</td>
											<td class="rowValue">
												<xsl:value-of select="urn:text"/>
											</td>
										</tr>
									</xsl:if>
									<!--ravi-->
									<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='7922000'">
										<tr>
											<td class="rowTitle">Ravi</td>
											<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='7922000']">
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</xsl:for-each>
										</tr>
									</xsl:if>
									<!--korraldused ja soovitused-->
									<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='424900004'">
										<tr>
											<td class="rowTitle">Korraldused ja soovitused</td>
											<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='424900004']">
												<td class="rowValue">
													<xsl:value-of select="urn:value"/>
												</td>
											</xsl:for-each>
										</tr>
									</xsl:if>
									<!--diagnoosid-->
									<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='DGN'">
										<tr>
											<td colspan="2">
												<xsl:call-template name="currentPregnancyDiagnose"/>
											</td>
										</tr>
									</xsl:if>
									<!--väljastatud ravimid-->
									<xsl:if test="urn:entryRelationship/urn:substanceAdministration">
										<tr>
											<td colspan="2">
												<table>
													<tr class="rowTitle">
														<th>Retsepti nr.</th>
														<th>Ravimi väljastamise kuupäev</th>
														<th>ATC kood</th>
														<th>Toimeaine nimetus</th>
														<th>Ravimvorm</th>
														<th>Ühekordne annus</th>
														<th>Manustamiskordi</th>
														<th>Retsept kehtiv kuni</th>
													</tr>
													<xsl:for-each select="urn:entryRelationship/urn:substanceAdministration">
														<tr class="rowValue">
															<td class="dataTableCell">
																<xsl:value-of select="urn:id/@extension"/>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:call-template name="dateFormat">
																	<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
																</xsl:call-template>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:value-of select="urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/@code"/>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:value-of select="urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/@displayName"/>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:value-of select="urn:administrationUnitCode/@displayName"/>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:value-of select="urn:doseQuantity/@value"/>
																<xsl:text> </xsl:text>
																<xsl:value-of select="urn:doseQuantity/@unit"/>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:value-of select="urn:rateQuantity/@value"/>
																<xsl:text> x </xsl:text>
																<xsl:call-template name="dateUnit">
																	<xsl:with-param name="mode" select="'per'"/>
																	<xsl:with-param name="unit" select="urn:rateQuantity/@unit"/>
																</xsl:call-template>
																&#160;	
															</td>
															<td class="dataTableCell">
																<xsl:call-template name="dateFormat">
																	<xsl:with-param name="date" select="urn:entryRelationship/urn:supply/urn:expectedUseTime/urn:high/@value"/>
																</xsl:call-template>
																&#160;	
															</td>
														</tr>
													</xsl:for-each>
												</table>
											</td>
										</tr>
									</xsl:if>
									<!--nõustamised-->
									<xsl:if test="urn:entryRelationship/urn:act">
										<tr>
											<td colspan="2">
												<table>
													<tr class="rowTitle">
														<th>Läbiviidud nõustamised</th>
													</tr>
													<xsl:for-each select="urn:entryRelationship/urn:act">
														<tr>
															<td>
																<xsl:value-of select="urn:code/@displayName"/>
																<xsl:if test="urn:code/urn:originalText">
																	<xsl:text>:  </xsl:text>
																	<xsl:value-of select="urn:code/urn:originalText"/>
																</xsl:if>
															</td>
														</tr>
													</xsl:for-each>
												</table>
											</td>
										</tr>
									</xsl:if>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	

Template for bLeaveState
	-->
	<xsl:template name="section.bLeaveState" match="urn:section" mode="bLeaveState">
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Seisund haiglast väljakirjutamisel</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BSTATE']/urn:value/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='BSTATE']/urn:value/@displayName"/>
				</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='BSTATE']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Kaal</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='363809009' or urn:code/@code='364589006']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='363809009' or urn:code/@code='364589006']/urn:value/@unit"/>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='WEIGTH' or urn:code/@code='363809009' or urn:code/@code='364589006']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle">Peaümbermõõt</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:value/@value"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:value/@unit"/>
				</td>
				<td class="rowTitle">Mõõtmise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='HPM']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" colspan="2">Nabaväädi köndi seisund</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.21']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.21']">
				<tr>
					<td class="rowValue" colspan="4">
						<span>
							<xsl:value-of select="@code"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:for-each>
			<tr>
				<td class="rowTitle">Testiste laskumine</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='TESTICL']/urn:value"/>
				</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='TESTICL']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" colspan="2">Vastsündinu/imiku toit</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.27']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" colspan="2">Kood ja nimetus</td>
				<td class="rowTitle" colspan="2">Selgitus</td>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.27']">
				<tr>
					<td class="rowValue" colspan="2">
						<span>
							<xsl:value-of select="@code"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="@displayName"/>
						</span>
					</td>
					<td class="rowValue" colspan="2">
						<span>
							<xsl:value-of select="urn:originalText"/>
						</span>
					</td>
				</tr>
			</xsl:for-each>
			<tr>
				<td class="rowTitle">Rinnapiima söömise viis</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.23']/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.23']/@displayName"/>
				</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.23']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" colspan="2">Vastsündinu naha seisund</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.26']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" colspan="2">Kood ja nimetus</td>
				<td class="rowTitle" colspan="2">Selgitus</td>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.26']">
				<tr>
					<td class="rowValue" colspan="2">
						<span>
							<xsl:value-of select="@code"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="@displayName"/>
						</span>
					</td>
					<td class="rowValue" colspan="2">
						<span>
							<xsl:value-of select="urn:originalText"/>
						</span>
					</td>
				</tr>
			</xsl:for-each>
			<tr>
				<td class="rowTitle">Vastsündinu naha-ja limaskestade värvus</td>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.25']/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.25']/@displayName"/>
				</td>
				<td class="rowTitle">Hindamise aeg</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:observation[substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.25']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--	


	Template for analyses and tests
	-->
	<xsl:template name="section.tests" match="urn:section" mode="tests">
		<xsl:choose>
			<xsl:when test="urn:text/@styleCode='xformatted'">
				<table>
					<tr>
						<td class="blockLabel">
							<xsl:value-of select="urn:title"/>
						</td>
					</tr>
				</table>
				<xsl:apply-templates select="urn:text" mode="row"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="testsAsXML"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--

	Template for reading tests table as xformatted text
	-->
	<xsl:template name="testsAsXML">
		<xsl:variable name="showParameter" select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation/urn:specimen/urn:specimenRole/urn:specimenPlayingEntity/urn:code/@displayName"/>
		<xsl:variable name="showReferenceValue" select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation/urn:referenceRange/urn:observationRange/urn:text/text()"/>
		<xsl:variable name="showUnit" select="urn:entry/urn:procedure/urn:entryRelationship/urn:observation/urn:specimen/urn:specimenRole/urn:specimenPlayingEntity/urn:desc/text()"/>
		<xsl:variable name="showSource" select="urn:entry/urn:procedure/urn:author"/>
		<xsl:variable name="showPerformer" select="urn:entry/urn:procedure/urn:performer"/>
		<table>
			<tr>
				<td colspan="8" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Nimetus</th>
				<xsl:if test="$showParameter">
					<th>Parameeter</th>
				</xsl:if>
				<xsl:if test="$showReferenceValue">
					<th>Referentsväärtus</th>
				</xsl:if>
				<th>Tulemused</th>
				<xsl:if test="$showUnit">
					<th>Ühik</th>
				</xsl:if>
				<xsl:if test="$showPerformer">
					<th>Teostaja</th>
				</xsl:if>
				<xsl:if test="$showSource">
					<th>Allikas</th>
				</xsl:if>
			</tr>
			<xsl:for-each select="urn:entry/urn:procedure">
				<xsl:variable name="rows" select="count(urn:entryRelationship)"/>
				<xsl:for-each select="urn:entryRelationship[urn:observation/urn:code/@code='ANA']">
					<tr class="rowValue">
						<xsl:if test="position()=1">
							<td rowspan="{$rows}" class="dataTableCell">
								<!--<xsl:value-of select="../urn:code[substring(@codeSystem,1,='2.16.840.1.113883.6.1']/@code"/>-->
								<xsl:value-of select="../urn:code/@code"/>
								<xsl:text> - </xsl:text>
								<!--<xsl:value-of select="../urn:code[@codeSystem='2.16.840.1.113883.6.1']/@displayName"/>-->
								<xsl:value-of select="../urn:code/@displayName"/>
								<xsl:text> </xsl:text>
								<!--<xsl:value-of select="../urn:targetSiteCode[@codeSystem='2.16.840.1.113883.6.96']/@displayName"/>-->
								<xsl:value-of select="../urn:targetSiteCode/@displayName"/>
								<!--alternatiivkoodid-->
								<xsl:for-each select="../urn:code/urn:translation">
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
								</xsl:for-each>
								&#160;	
							</td>
						</xsl:if>
						<xsl:apply-templates select="urn:observation" mode="tests">
							<xsl:with-param name="showParameter" select="$showParameter"/>
							<xsl:with-param name="showReferenceValue" select="$showReferenceValue"/>
							<xsl:with-param name="showUnit" select="$showUnit"/>
							<xsl:with-param name="showPerformer" select="$showPerformer"/>
							<xsl:with-param name="showSouce" select="$showSource"/>
						</xsl:apply-templates>
					</tr>
				</xsl:for-each>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for analyses details
	-->
	<xsl:template name="observation.tests" match="urn:observation" mode="tests">
		<xsl:param name="showParameter"/>
		<xsl:param name="showReferenceValue"/>
		<xsl:param name="showUnit"/>
		<xsl:param name="showSource"/>
		<xsl:param name="showPerformer"/>
		<xsl:if test="$showParameter">
			<td class="dataTableCell">
				<xsl:value-of select="urn:specimen/urn:specimenRole/urn:specimenPlayingEntity/urn:code/@code"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="urn:specimen/urn:specimenRole/urn:specimenPlayingEntity/urn:code/@displayName"/>
				&#160;	
			</td>
		</xsl:if>
		<xsl:if test="$showReferenceValue">
			<td class="dataTableCell">
				<xsl:value-of select="urn:referenceRange/urn:observationRange/urn:text"/>
				&#160;	
			</td>
		</xsl:if>
		<td class="dataTableCell">
			<xsl:if test="urn:entryRelationship/urn:observation">
				<table>
					<tr>
						<td>Kuupäev</td>
						<td>Tulemus</td>
					</tr>
					<xsl:for-each select="urn:entryRelationship/urn:observation">
						<tr>
							<td>
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
									<xsl:with-param name="format" select="'time'"/>
								</xsl:call-template>
								&#160;	
							</td>
							<td>
								<xsl:value-of select="urn:value"/>
								&#160;	
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</xsl:if>
		</td>
		<xsl:if test="$showUnit">
			<td class="dataTableCell">
				<xsl:value-of select="urn:specimen/urn:specimenRole/urn:specimenPlayingEntity/urn:desc"/>
				&#160;	
			</td>
		</xsl:if>
		<xsl:if test="$showPerformer">
			<td class="dataTableCell">
				<table>
					<xsl:for-each select="../../../urn:procedure/urn:performer">
						<xsl:apply-templates select="."/>
					</xsl:for-each>
				</table>
				&#160;	
			</td>
		</xsl:if>
		<xsl:if test="../../../urn:procedure/urn:author">
			<td class="dataTableCell">
				<xsl:for-each select="../../../urn:procedure">
					<xsl:call-template name="timeCriticalSourceAuthor">
						<xsl:with-param name="tabel" select="'Jah'"/>
					</xsl:call-template>
				</xsl:for-each>
				&#160;	
			</td>
		</xsl:if>
	</xsl:template>
	<!--

	Template for immunization
	-->
	<xsl:template name="section.immunization" match="urn:section" mode="immunization">
		<xsl:param name="ageGroup"/>
		<table>
			<xsl:for-each select="urn:entry/urn:procedure[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
				<tr>
					<td colspan="3" class="blockLabel">
						<xsl:value-of select="urn:code/@displayName"/>
						<xsl:text> </xsl:text>
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
						<xsl:for-each select="urn:methodCode">
							<xsl:text> - </xsl:text>
							<xsl:value-of select="@code"/>
							<xsl:text>  </xsl:text>
							<xsl:value-of select="@displayName"/>
							<xsl:text>,  </xsl:text>
						</xsl:for-each>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">Vanusegrupp</td>
					<td colspan="2" class="rowValue">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
				<xsl:for-each select="urn:entryRelationship/urn:substanceAdministration">
					<xsl:for-each select="urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial">
						<tr>
							<td class="rowTitle">Vaktsiin</td>
							<td colspan="2" class="rowValue">
								<xsl:value-of select="urn:code/@code"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:code/@displayName"/>
							</td>
						</tr>
						<tr>
							<td class="rowTitle">Partii nr</td>
							<td colspan="2" class="rowValue">
								<xsl:value-of select="urn:lotNumberText"/>
							</td>
						</tr>
					</xsl:for-each>
					<tr>
						<td class="rowTitle">Annus</td>
						<td colspan="2" class="rowValue">
							<xsl:value-of select="urn:doseQuantity/@value"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="urn:doseQuantity/@unit"/>
						</td>
					</tr>
				</xsl:for-each>
				<xsl:if test="urn:performer/urn:assignedEntity">
					<tr>
						<td colspan="3" class="rowTitle">Immuniseerija</td>
					</tr>
					<tr>
						<td colspan="3">
							<xsl:apply-templates select="urn:performer/urn:assignedEntity" mode="immunizer"/>
						</td>
					</tr>
				</xsl:if>
				<xsl:if test="urn:entryRelationship/urn:observation[urn:interpretationCode/@code='IMMEFF']">
					<tr>
						<td colspan="3">
							<table>
								<tr>
									<td colspan="3" class="blockLabel">Kõrvalnähud					
						</td>
								</tr>
								<tr class="rowTitle">
									<th>Kuupäev</th>
									<th>Kõrvalnäht</th>
									<th>Märkija</th>
								</tr>
								<xsl:for-each select="urn:entryRelationship/urn:observation[urn:interpretationCode/@code='IMMEFF']">
									<tr>
										<td class="dataTableCell">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
											</xsl:call-template>
										</td>
										<td class="dataTableCell">
											<xsl:for-each select="urn:value">
												<xsl:value-of select="@code"/>
												<xsl:text> - </xsl:text>
												<xsl:value-of select="@displayName"/>
												<br/>
											</xsl:for-each>
										</td>
										<td class="dataTableCell">
											<xsl:apply-templates select="urn:performer/urn:assignedEntity" mode="immunizer"/>
										</td>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</tr>
				</xsl:if>
				<xsl:if test="urn:author">
					<tr>
						<td colspan="3">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</td>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for contraindication
	-->
	<xsl:template name="section.contraindication" match="urn:section" mode="contraindication">
		<table>
			<tr>
				<td colspan="3" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Vastunäidustus</th>
				<th>Märkija</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation">
				<tr>
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/@code"/>
						<xsl:text> - </xsl:text>
						<xsl:value-of select="urn:value/@displayName"/>
						<br/>
						<xsl:for-each select="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial">
							<xsl:value-of select="urn:code/@code"/>
							<xsl:text> - </xsl:text>
							<xsl:value-of select="urn:code/@displayName"/>
							<br/>
							<xsl:value-of select="urn:lotNumberText"/>
						</xsl:for-each>
					</td>
					<td class="dataTableCell">
						<xsl:apply-templates select="urn:performer/urn:assignedEntity" mode="immunizer"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
Template for immunizer info
	-->
	<xsl:template name="assignedEntity.immunizer" match="urn:assignedEntity" mode="immunizer">
		<table>
			<tr>
				<td>
					<span class="rowTitle">Nimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:assignedPerson/urn:name"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Eriala</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="ext:asLicencedEntity/ext:id[substring(@root,1,25)='1.3.6.1.4.1.28284.6.2.1.4']/@extension"/>
					</span>
					<xsl:text> - </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="ext:asLicencedEntity/ext:id[substring(@root,1,25)='1.3.6.1.4.1.28284.6.2.1.4']/@assigningAuthorityName"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--



	Template for SUIDobservations
	-->
	<xsl:template name="section.SUIDobservation" match="urn:section" mode="SUIDobservation">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation">
						<!--vahejoon-->
						<tr>
							<td class="tableBlock" colspan="2">
								<br/>
							</td>
						</tr>
						<!--uuringukoodid algus-->
						<tr>
							<td class="rowTitle">Uuringukoodid</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/@code"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:code/@displayName"/>
								<xsl:text>:  </xsl:text>
								<xsl:value-of select="urn:code/@codeSystemName"/>
								<br/>
								<xsl:for-each select="urn:code/urn:translation">
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
								</xsl:for-each>
							</td>
						</tr>
						<!--uuringukoodid lõpp-->
						<!--paikmete tabeli algus-->
						<tr>
							<td colspan="2">
								<table>
									<tr class="rowTitle">
										<th>Paikmed</th>
										<th>Täpsustused</th>
									</tr>
									<xsl:for-each select="urn:targetSiteCode">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:value-of select="@code"/>
												<xsl:text> - </xsl:text>
												<xsl:value-of select="@displayName"/>
												<xsl:text>:  </xsl:text>
												<xsl:value-of select="@codeSystemName"/>
											</td>
											<td class="dataTableCell">
												<xsl:for-each select="urn:qualifier">
													<xsl:value-of select="urn:value/@code"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="urn:value/@displayName"/>
													<xsl:text>:  </xsl:text>
													<xsl:value-of select="urn:value/@codeSystemName"/>
													<br/>
												</xsl:for-each>
											</td>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
						<!--paikmete tabeli lõpp-->
						<!--seadmete tabeli algus-->
						<tr>
							<td colspan="2">
								<table>
									<tr class="rowTitle">
										<th>Aeg</th>
										<th>Seadme/Inventari nr</th>
										<th>Kontaktkoordinaadid</th>
										<th>Tootja antud tüübinimi</th>
										<th>Seadme kuuluvus asutusele</th>
									</tr>
									<xsl:for-each select="urn:author">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:call-template name="dateFormat">
													<xsl:with-param name="date" select="urn:time/@value"/>
												</xsl:call-template>
											</td>
											<td class="dataTableCell">
												<xsl:for-each select="urn:assignedAuthor/urn:id">
													<xsl:value-of select="@extension"/>
													<br/>
												</xsl:for-each>
											</td>
											<td class="dataTableCell">
												<table>
													<xsl:for-each select="urn:assignedAuthor/urn:telecom">
														<tr>
															<td>
																<xsl:value-of select="@value"/>
															</td>
														</tr>
													</xsl:for-each>
												</table>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:assignedAuthor/urn:assignedAuthoringDevice/urn:manufacturerModelName"/>
											</td>
											<td class="dataTableCell">
												<table>
													<tr>
														<td class="rowTitle">Registreerimiskood</td>
														<td class="rowValue">
															<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:id[@root='1.3.6.1.4.1.28284.4']/@extension"/>
															<br/>
															<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.1']/@extension"/>
														</td>
													</tr>
													<tr>
														<td class="rowTitle">Litsentsi kood</td>
														<td class="rowValue">
															<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:id[@root='1.3.6.1.4.1.28284.1']/@extension"/>
														</td>
													</tr>
													<xsl:if test="@root!='1.3.6.1.4.1.28284.4' and @root!='1.3.6.1.4.1.28284.6.2.4.1' and @root!='1.3.6.1.4.1.28284.1' ">
														<tr>
															<td class="rowTitle">Kood</td>
															<td class="rowValue">
																<xsl:for-each select="urn:assignedAuthor/urn:representedOrganization/urn:id">
																	<xsl:if test="@root!='1.3.6.1.4.1.28284.4' and @root!='1.3.6.1.4.1.28284.6.2.4.1' and @root!='1.3.6.1.4.1.28284.1' ">
																		<xsl:value-of select="@extension"/>
																		<br/>
																	</xsl:if>
																</xsl:for-each>
															</td>
														</tr>
													</xsl:if>
													<tr>
														<td class="rowTitle">Nimi</td>
														<td class="rowValue">
															<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:name"/>
														</td>
													</tr>
													<tr>
														<td class="rowTitle">Kontaktkoordinaadid</td>
														<td class="rowValue">
															<table>
																<xsl:for-each select="urn:assignedAuthor/urn:representedOrganization/urn:telecom">
																	<tr>
																		<td>
																			<xsl:value-of select="@value"/>
																		</td>
																	</tr>
																</xsl:for-each>
															</table>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
						<!--seadmete tabeli lõpp-->
						<!--seadmeoperaatori algus-->
						<xsl:for-each select="urn:participant[@typeCode='PRF']/urn:participantRole">
							<tr class="blockLabel">
								<td colspan="2">Seadmeoperaator</td>
							</tr>
							<tr>
								<td class="rowTitle">Registrikood</td>
								<td class="dataTableCell">
									<xsl:value-of select="urn:id/@extension"/>
								</td>
							</tr>
							<tr>
								<td class="rowTitle">Tüüp</td>
								<td class="dataTableCell">
									<xsl:value-of select="urn:code/@displayName"/>
								</td>
							</tr>
							<tr>
								<td class="rowTitle">Nimi</td>
								<td class="dataTableCell">
									<xsl:apply-templates select="urn:playingEntity/urn:name"/>
								</td>
							</tr>
						</xsl:for-each>
						<!--seadmeoperaatori lõpp-->
						<!--PACSi salvestamise sündmuse algus-->
						<tr>
							<td colspan="2">
								<table>
									<tr class="rowTitle">
										<th>PACSi operatsioon</th>
										<th>Aeg</th>
										<th>PACSi ID</th>
										<th>Kontaktkoordinaadid</th>
										<th>Pildihoidla</th>
										<th>Pildi SUID</th>
									</tr>
									<xsl:for-each select="urn:entryRelationship/urn:act">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:value-of select="urn:code/@displayName"/>
											</td>
											<td class="dataTableCell">
												<xsl:call-template name="dateFormat">
													<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
												</xsl:call-template>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:performer/urn:assignedEntity/urn:id/@extension"/>
											</td>
											<td class="dataTableCell">
												<table>
													<xsl:for-each select="urn:performer/urn:assignedEntity/urn:telecom">
														<tr>
															<td>
																<xsl:value-of select="@value"/>
															</td>
														</tr>
													</xsl:for-each>
												</table>
											</td>
											<td class="dataTableCell">
												<table>
													<tr>
														<td class="rowTitle">Registreerimiskood</td>
														<td class="rowValue">
															<xsl:value-of select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:id[@root='1.3.6.1.4.1.28284.4']/@extension"/>
															<br/>
															<xsl:value-of select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.1']/@extension"/>
														</td>
													</tr>
													<xsl:if test="@root!='1.3.6.1.4.1.28284.4' and @root!='1.3.6.1.4.1.28284.6.2.4.1'">
														<tr>
															<td class="rowTitle">Kood</td>
															<td class="rowValue">
																<xsl:for-each select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:id">
																	<xsl:if test="@root!='1.3.6.1.4.1.28284.4' and @root!='1.3.6.1.4.1.28284.6.2.4.1' ">
																		<xsl:value-of select="@extension"/>
																		<br/>
																	</xsl:if>
																</xsl:for-each>
															</td>
														</tr>
													</xsl:if>
													<tr>
														<td class="rowTitle">Nimi</td>
														<td class="rowValue">
															<xsl:value-of select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:name"/>
														</td>
													</tr>
													<tr>
														<td class="rowTitle">Kontaktkoordinaadid</td>
														<td class="rowValue">
															<table>
																<xsl:for-each select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:telecom">
																	<tr>
																		<td>
																			<xsl:value-of select="@value"/>
																		</td>
																	</tr>
																</xsl:for-each>
															</table>
														</td>
													</tr>
												</table>
											</td>
											<!--suid-->
											<td class="dataTableCell">
												<xsl:value-of select="urn:reference/urn:externalObservation/urn:id/@extension"/>
											</td>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
						<!--PACSi salvestamise sünmuse lõpp-->
						<!--tegelik viit algus-->
						<tr class="blockLabel">
							<td colspan="2">Tegelik pildiviit</td>
						</tr>
						<tr>
							<td class="rowTitle">SUID</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:reference/urn:externalObservation/urn:id/@extension"/>
							</td>
						</tr>
						<tr>
							<td class="rowTitle">Uuringukoodid</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:reference/urn:externalObservation/urn:code/@code"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:reference/urn:externalObservation/urn:code/@displayName"/>
								<xsl:text>:  </xsl:text>
								<xsl:value-of select="urn:reference/urn:externalObservation/urn:code/@codeSystemName"/>
								<br/>
								<xsl:for-each select="urn:reference/urn:externalObservation/urn:code/urn:translation">
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
									<br/>
								</xsl:for-each>
							</td>
						</tr>
						<tr>
							<td class="rowTitle">Viit</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:reference/urn:externalObservation/urn:text"/>
							</td>
						</tr>
						<!--tegelik viit lõpp-->
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--



	Template for statistical data for different procedures
	-->
	<xsl:template name="section.statProcedures" match="urn:section" mode="statProcedures">
		<table>
			<tr>
				<td colspan="8" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Kuupäev</th>
						<xsl:if test="urn:code[@code='STATPROC']">
							<th>Toimingu liik</th>
						</xsl:if>
						<th>Kood ja nimetus</th>
						<xsl:if test="urn:entry/urn:procedure/urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.34']">
							<th>Hulk</th>
						</xsl:if>
						<xsl:if test="urn:entry/urn:procedure/urn:performer">
							<th>Teostaja</th>
						</xsl:if>
						<xsl:if test="urn:entry/urn:procedure/urn:author">
							<th>Allikas</th>
						</xsl:if>
					</tr>
					<xsl:for-each select="urn:entry/urn:procedure">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
							<xsl:if test="../../../urn:section/urn:code[@code='STATPROC']">
								<td class="dataTableCell">
									<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.10']/@displayName"/>
								</td>
							</xsl:if>
							<td class="dataTableCell">
								<xsl:for-each select="urn:code">
									<xsl:value-of select="@code"/>
									<xsl:text> - </xsl:text>
									<xsl:value-of select="@displayName"/>
									<br/>
									<xsl:for-each select="urn:qualifier/urn:value[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.1.9']/@code">
										<xsl:apply-templates select="." mode="formatting"/>
										<br/>
									</xsl:for-each>
									<!--Alternatiivkoodid-->
									<xsl:for-each select="urn:translation">
										<br/>
										<xsl:apply-templates select="." mode="formatting">
											<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
										</xsl:apply-templates>
									</xsl:for-each>
								</xsl:for-each>
								<xsl:if test="urn:text">
									<br/>
									<xsl:value-of select="urn:text"/>
								</xsl:if>
							</td>
							<xsl:if test="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.34']">
								<td class="dataTableCell">
									<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.34']/@code"/>
								</td>
							</xsl:if>
							<xsl:if test="urn:performer">
								<td class="dataTableCell">
									<xsl:value-of select="urn:performer/urn:assignedEntity/urn:id/@extension"/>
									<xsl:value-of select="urn:performer/urn:assignedEntity/urn:representedOrganization/urn:name"/>
								</td>
							</xsl:if>
							<xsl:if test="urn:author">
								<td class="dataTableCell">
									<xsl:call-template name="timeCriticalSourceAuthor">
										<xsl:with-param name="tabel" select="'Jah'"/>
									</xsl:call-template>
								</td>
							</xsl:if>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--



	Template for nurse procedures
	-->
	<xsl:template name="section.nurseProcedures" match="urn:section" mode="nurseProcedures">
		<table>
			<tr>
				<td colspan="8" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Kuupäev</th>
						<th>Kirjeldus</th>
						<th>Hulk</th>
					</tr>
					<xsl:for-each select="urn:entry/urn:procedure">
						<tr>
							<td class="dataTableCell">
								<xsl:choose>
									<xsl:when test="urn:effectiveTime/urn:low">
										<xsl:call-template name="dateFormat">
											<xsl:with-param name="date" select="urn:effectiveTime/urn:low/@value"/>
										</xsl:call-template>
										<xsl:text> - </xsl:text>
										<xsl:call-template name="dateFormat">
											<xsl:with-param name="date" select="urn:effectiveTime/urn:high/@value"/>
										</xsl:call-template>
									</xsl:when>
									<xsl:otherwise>
										<xsl:call-template name="dateFormat">
											<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
										</xsl:call-template>
									</xsl:otherwise>
								</xsl:choose>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:text"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.34']/@code"/>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for showing diagnoses list
	Takes a list of urn:observations as arguments
	-->
	<xsl:template name="diagnoses">
		<xsl:param name="list"/>
		<xsl:param name="showDate"/>
		<xsl:param name="showRecurrency"/>
		<xsl:param name="showMaterial"/>
		<xsl:param name="showCStadium"/>
		<xsl:param name="showPStadium"/>
		<xsl:param name="codeSystem"/>
		<xsl:param name="showDiagnoos"/>
		<xsl:param name="showPaikmed"/>
		<xsl:param name="showOriginalText"/>
		<xsl:param name="showCTNM"/>
		<xsl:param name="showPTNM"/>
		<xsl:param name="showG"/>
		<!--<code>tekst  <xsl:value-of select="$showOriginalText"/></code>-->
		<table>
			<tr class="rowTitle">
				<xsl:if test="$showDate">
					<th>Kuupäev</th>
				</xsl:if>
				<xsl:if test="$showMaterial">
					<th>Materjal / Ravim</th>
				</xsl:if>
				<xsl:if test="$showDiagnoos">
					<th>Diagnoos</th>
				</xsl:if>
				<xsl:if test="$showPaikmed">
					<th>Paikmed</th>
				</xsl:if>
				<xsl:if test="$showOriginalText='true'">
					<th>Sõnaline diagnoos</th>
				</xsl:if>
				<xsl:if test="$showRecurrency">
					<th>Statistiline liik</th>
				</xsl:if>
				<xsl:if test="$showCTNM">
					<th>Kliinilne TNM</th>
				</xsl:if>
				<xsl:if test="$showCStadium">
					<th>Kliinilne staadium</th>
				</xsl:if>
				<xsl:if test="$showPTNM">
					<th>Patoloogiline TNM</th>
				</xsl:if>
				<xsl:if test="$showPStadium">
					<th>Patoloogiline staadium</th>
				</xsl:if>
				<xsl:if test="$showG">
					<th>Diferentseerimisaste</th>
				</xsl:if>
				<xsl:if test="urn:entry/urn:observation/urn:author">
					<th>Allikas</th>
				</xsl:if>
			</tr>
			<xsl:for-each select="$list">
				<tr class="rowValue">
					<xsl:if test="$showDate">
						<td class="dataTableCell">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
							</xsl:call-template>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showMaterial">
						<td class="dataTableCell">
							<xsl:if test="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedLabeledDrug/urn:name">
								<xsl:value-of select="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedLabeledDrug/urn:name"/>
								<br/>
							</xsl:if>
							<xsl:value-of select="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:name"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showDiagnoos">
						<td class="dataTableCell">
							<span class="rowValue">
								<xsl:apply-templates select="urn:value[substring(@codeSystem,1,26)=$codeSystem]" mode="formatting"/>
								<!--Alternatiivkoodid-->
								<xsl:for-each select="urn:value/urn:translation">
									<br/>
									<xsl:apply-templates select="." mode="formatting">
										<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
									</xsl:apply-templates>
									<br/>
								</xsl:for-each>
							</span>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showPaikmed">
						<td class="dataTableCell">
							<span class="rowValue">
								<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.44']/@displayName"/>
							</span>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showOriginalText='true'">
						<td class="dataTableCell">
							<span class="rowValue">
								<xsl:value-of select="urn:value/urn:originalText"/>
							</span>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showRecurrency">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value[substring(@codeSystem,1,26)=$codeSystem]/urn:qualifier/urn:value[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.1.1']/@displayName"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showCTNM">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.70']/@code"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showCStadium">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.75']/@displayName"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showPTNM">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.71']/@code"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showPStadium">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.76']/@displayName"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="$showG">
						<td class="dataTableCell">
							<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.42']/@code"/>
							&#160;	
						</td>
					</xsl:if>
					<xsl:if test="urn:author">
						<td class="dataTableCell">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Jah'"/>
							</xsl:call-template>
							&#160;	
						</td>
					</xsl:if>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	
	Template for showing all diagnoses from section
	-->
	<xsl:template name="section.diagnosis" match="urn:section" mode="diagnoses">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<xsl:variable name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
							<xsl:call-template name="diagnoses">
								<xsl:with-param name="list" select="urn:entry/urn:observation"/>
								<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation/urn:effectiveTime)=0)"/>
								<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)=$codeSystem]/urn:qualifier/urn:value[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.1.1'])=0)"/>
								<xsl:with-param name="showMaterial" select="not(count(urn:entry/urn:observation/urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct)=0)"/>
								<xsl:with-param name="showCStadium" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)=$codeSystem]/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.75'])=0)"/>
								<xsl:with-param name="showPStadium" select="not(count(urn:entry/urn:observation/urn:value[@codeSystem=$codeSystem]/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.76'])=0)"/>
								<xsl:with-param name="showOriginalText" select="not(count(urn:entry/urn:observation/urn:value/urn:originalText)=0)"/>
								<xsl:with-param name="showDiagnoos" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13'])=0)"/>
								<xsl:with-param name="showPaikmed" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.44'])=0)"/>
								<xsl:with-param name="showCTNM" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.70'])=0)"/>
								<xsl:with-param name="showPTNM" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.71'])=0)"/>
								<xsl:with-param name="showG" select="not(count(urn:entry/urn:observation/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.42'])=0)"/>
								<xsl:with-param name="codeSystem" select="$codeSystem"/>
							</xsl:call-template>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	
Template for diagnoses info
	-->
	<xsl:template name="section.epicrisisDiagnosis" match="urn:section" mode="epicrisisDiagnoses">
		<table>
			<xsl:if test="urn:code/@code!='CASES'">
				<tr>
					<td class="blockLabel">
						<xsl:value-of select="urn:title"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:entry/urn:observation/urn:interpretationCode/@code='MAIN'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Põhihaigus </span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']/urn:value/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:interpretationCode/@code='MAIN_COMPL'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Põhihaiguse tüsistused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']/urn:value/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:interpretationCode/@code='BY_ILLNESS'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Kaasuvad haigused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='BY_ILLNESS']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='BY_ILLNESS']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='BY_ILLNESS']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:interpretationCode/@code='OUTER'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Välispõhjused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='OUTER']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='OUTER']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='OUTER']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'false'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:interpretationCode/@code='TNM'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Pahaloomulise kasvaja levik</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='TNM']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='TNM']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='TNM']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="showCStadium" select="'true'"/>
												<xsl:with-param name="showPStadium" select="'true'"/>
												<xsl:with-param name="showOriginalText" select="'false'"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.16'"/>
												<xsl:with-param name="showPaikmed" select="'true'"/>
												<xsl:with-param name="showCTNM" select="'true'"/>
												<xsl:with-param name="showPTNM" select="'true'"/>
												<xsl:with-param name="showG" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	
Template for reference diagnoses info
	-->
	<xsl:template name="section.refDiagnosis" match="urn:section" mode="refDiagnoses">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:text>Kliiniline diagnoos</xsl:text>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation/urn:interpretationCode/@code='MAIN'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Põhihaigus </span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN']/urn:value/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation/urn:interpretationCode/@code='MAIN_COMPL'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Põhihaiguse tüsistused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='MAIN_COMPL']/urn:value/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation/urn:interpretationCode/@code='BY_ILLNESS'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Kaasuvad haigused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='BY_ILLNESS']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship//urn:observation[urn:interpretationCode/@code='BY_ILLNESS']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='BY_ILLNESS']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'true'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation/urn:interpretationCode/@code='OUTER'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Välispõhjused</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='OUTER']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='OUTER']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='OUTER']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.13'"/>
												<xsl:with-param name="showOriginalText" select="'false'"/>
												<xsl:with-param name="showDiagnoos" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation/urn:interpretationCode/@code='TNM'">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">Pahaloomulise kasvaja levik</span>
											<xsl:text> </xsl:text>
											<span class="rowValue">
												<xsl:apply-templates select="urn:value" mode="formatting"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='TNM']"/>
												<xsl:with-param name="showDate" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='TNM']/urn:effectiveTime)=0)"/>
												<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:encounter/urn:entryRelationship/urn:observation/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='TNM']/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/urn:qualifier/urn:value)=0)"/>
												<xsl:with-param name="showCStadium" select="'true'"/>
												<xsl:with-param name="showPStadium" select="'true'"/>
												<xsl:with-param name="showOriginalText" select="'false'"/>
												<xsl:with-param name="codeSystem" select="'1.3.6.1.4.1.28284.6.2.1.16'"/>
												<xsl:with-param name="showPaikmed" select="'true'"/>
												<xsl:with-param name="showCTNM" select="'true'"/>
												<xsl:with-param name="showPTNM" select="'true'"/>
												<xsl:with-param name="showG" select="'true'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for nurseDiagnosis
	-->
	<xsl:template name="section.nurseDiagnosis" match="urn:section" mode="nurseDiagnoses">
		<table>
			<tr>
				<td class="blockLabel" colspan="3">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Diagnoos</th>
				<th>Sõnaline diagnoos</th>
				<th>Statistiline liik</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation">
				<tr>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/@code"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="urn:value/@displayName"/>
						<xsl:for-each select="urn:value/urn:translation">
							<br/>
							<xsl:apply-templates select="." mode="formatting">
								<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
							</xsl:apply-templates>
						</xsl:for-each>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/urn:originalText"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	Template for attender info
	-->
	<xsl:template name="assignedEntity.attender" match="urn:assignedEntity" mode="attender">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="../../../../urn:title"/>
				</td>
			</tr>
			<tr>
				<xsl:choose>
					<xsl:when test="urn:assignedPerson/urn:name">
						<td>
							<span class="rowTitle">Nimi</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:apply-templates select="urn:assignedPerson/urn:name"/>
							</span>
						</td>
					</xsl:when>
				</xsl:choose>
				<td>
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:apply-templates select="urn:representedOrganization" mode="attender"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for attender company info
	-->
	<xsl:template name="representedOrganization.attender" match="urn:representedOrganization" mode="attender">
		<table>
			<tr>
				<td colspan="2">
					<span class="blockLabel">
						<xsl:value-of select="urn:standardIndustryClassCode/@displayName"/>
					</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:name"/>
					</span>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:id[@root='1.3.6.1.4.1.28284.4']">
					<tr>
						<td class="rowTitle">Praksise registrikood</td>
						<td class="rowValue">
							<xsl:value-of select="urn:id/@extension"/>
						</td>
					</tr>
				</xsl:when>
			</xsl:choose>
			<xsl:choose>
				<xsl:when test="urn:addr">
					<tr>
						<td>
							<table>
								<tr>
									<td class="blockLabel">Tegevuskoha aadressid</td>
								</tr>
								<xsl:for-each select="urn:addr">
									<tr>
										<td class="dataTableCell">
											<xsl:apply-templates select="../urn:addr[@use='PHYS']"/>
										</td>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</tr>
				</xsl:when>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--


Template for refattender info
	-->
	<xsl:template name="assignedEntity.refattender" match="urn:assignedEntity" mode="refattender">
		<table>
			<tr>
				<xsl:choose>
					<xsl:when test="../../urn:encounterParticipant[@typeCode='REF']">
						<td class="blockLabel">Suunaja</td>
					</xsl:when>
					<xsl:otherwise>
						<td class="blockLabel">Telemeditsiinilisel konsultatsioonil osaleja</td>
					</xsl:otherwise>
				</xsl:choose>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Nimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:assignedPerson/urn:name"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<table>
						<tr>
							<td colspan="2" class="blockLabel">Eriala</td>
						</tr>
						<tr class="rowTitle">
							<th>Kood</th>
							<th>Eriala</th>
						</tr>
						<xsl:for-each select="ext:asLicencedEntity/ext:id">
							<tr class="rowValue">
								<td class="dataTableCell">
									<xsl:value-of select="@extension"/>
								</td>
								<td class="dataTableCell">
									<xsl:value-of select="@assigningAuthorityName"/>
								</td>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:apply-templates select="urn:representedOrganization" mode="refattender"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for reference info
	-->
	<xsl:template name="order.reference" match="urn:order" mode="reference">
		<table>
			<tr>
				<td class="blockLabel">Saatekiri/tellimus</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Saatekirja/tellimuse number</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="urn:code">
				<tr>
					<td>
						<span class="rowTitle">Dokumendi liik</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:code/@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--

	Template for refattender company info
	-->
	<xsl:template name="representedOrganization.refattender" match="urn:representedOrganization" mode="refattender">
		<table>
			<tr>
				<td>
					<span class="blockLabel">
						<xsl:value-of select="urn:standardIndustryClassCode/@displayName"/>
					</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:name"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.4']/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="urn:addr">
				<tr>
					<td>
						<span class="rowTitle">Aadress</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:apply-templates select="urn:addr"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:telecom">
				<tr>
					<td>
						<xsl:call-template name="telecomFormat"/>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--

	Template for telecommunication
	-->
	<xsl:template name="section.telecommunication" match="urn:section" mode="telecommunication">
		<table>
			<xsl:for-each select="urn:entry">
				<xsl:apply-templates select="urn:act/urn:performer/urn:assignedEntity" mode="refattender"/>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--Template for doctor info
	-->
	<xsl:template name="assignedEntity.doctor" match="urn:assignedEntity" mode="doctor">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">Raviarst/õde</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Nimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:assignedPerson/urn:name"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<table>
						<tr>
							<td colspan="2" class="blockLabel">Eriala</td>
						</tr>
						<tr class="rowTitle">
							<th>Kood</th>
							<th>Eriala</th>
						</tr>
						<xsl:for-each select="ext:asLicencedEntity/ext:id">
							<tr class="rowValue">
								<td class="dataTableCell">
									<xsl:value-of select="@extension"/>
								</td>
								<td class="dataTableCell">
									<xsl:value-of select="@assigningAuthorityName"/>
								</td>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Telefon</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,4)='tel:']/@value, 5)"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">E-post</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,7)='mailto:']/@value, 8)"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">Faks</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,4)='fax:']/@value,5)"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--


Template for contactrefattender info
	-->
	<xsl:template name="assignedEntity.contactrefattender" match="urn:assignedEntity" mode="contactrefattender">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">Suunaja kontaktisik</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Nimi</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:apply-templates select="urn:assignedPerson/urn:name"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">Kood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">Telefon</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,4)='tel:']/@value, 5)"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">E-post</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,7)='mailto:']/@value, 8)"/>
					</span>
				</td>
				<td>
					<span class="rowTitle">Faks</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="substring(urn:telecom[substring(@value,1,4)='fax:']/@value,5)"/>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for completeEncounter info
	accepts parameter with name 'encounterType' with valid values 'stat', 'amb', 'nurse', 'day', 'birth', 'statStat', 'statAmb', statDay'
	-->
	<xsl:template name="completeEncounter.encounter" match="urn:encompassingEncounter" mode="encompassingEncounter">
		<xsl:param name="encounterType"/>
		<table>
			<xsl:choose>
				<xsl:when test="$encounterType='nurse'">
					<tr>
						<td colspan="2" class="blockLabel">Õendusabi osutamise periood</td>
					</tr>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td colspan="2" class="blockLabel">Haigusjuhtum</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
			<tr>
				<td colspan="3">
					<!-- encounter type -->
					<xsl:choose>
						<xsl:when test="$encounterType='statStat' or $encounterType='statAmb' or $encounterType='statDay'">
							<span class="rowTitle">Haigusjuhtumi liik</span>
							<xsl:text>  </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:code/@displayName"/>
							</span>
						</xsl:when>
					</xsl:choose>
				</td>
			</tr>
			<xsl:if test="ext:encounter/ext:admissionReferralSourceCode">
				<tr>
					<td colspan="3">
						<span class="rowTitle">Saabumise viis</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="ext:encounter/ext:admissionReferralSourceCode[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.10']/@code"/>
						</span>
						<xsl:text> - </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="ext:encounter/ext:admissionReferralSourceCode[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.10']/@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:for-each select="ext:encounter/ext:priorityCode">
				<tr>
					<td colspan="3">
						<span class="rowTitle">Pöördumise erakorralisus</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:for-each>
			<tr>
				<td>
					<span class="rowTitle">Algus</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:low/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
				<td>
					<span class="rowTitle">Lõpp</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:high/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
			<xsl:if test="$encounterType='nurse' and ../../urn:component/urn:structuredBody/urn:component/urn:section[urn:code/@code='HH']/urn:entry/urn:encounter/urn:entryRelationship/urn:observation[urn:code/@code='REASON']/urn:value">
				<tr>
					<td>
						<span class="rowTitle">Põhjendus</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="../../urn:component/urn:structuredBody/urn:component/urn:section[urn:code/@code='HH']/urn:entry/urn:encounter/urn:entryRelationship/urn:observation[urn:code/@code='REASON']/urn:value"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td colspan="3">
					<xsl:choose>
						<xsl:when test="$encounterType='stat' or $encounterType='birth'">
							<span class="rowTitle">Voodipäevi kokku</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="ext:encounter/ext:lengthOfStayQuantity/@value"/>
							</span>
						</xsl:when>
						<xsl:when test="$encounterType='day'">
							<span class="rowTitle">Päevaravi päevade arv</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="ext:encounter/ext:lengthOfStayQuantity/@value"/>
							</span>
						</xsl:when>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<!-- template for visits to subdepartments whithin this visit -->
					<xsl:choose>
						<xsl:when test="$encounterType='amb' or $encounterType='day' or $encounterType='statAmb'">
							<xsl:call-template name="relatedEncountersNarrow">
								<xsl:with-param name="encounterType" select="$encounterType"/>
							</xsl:call-template>
						</xsl:when>
						<xsl:when test="$encounterType='stat' or $encounterType='statDay' or $encounterType='statStat' ">
							<xsl:call-template name="relatedEncountersWide"/>
						</xsl:when>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<!-- template for child address -->
					<xsl:choose>
						<xsl:when test="$encounterType='birth'">
							<span class="rowTitle">Aadress, kuhu vastsündinu viiakse (kui läheb koju)</span>
							<xsl:text>  </xsl:text>
							<span class="rowValue">
								<xsl:apply-templates select="../../urn:component/urn:structuredBody/urn:component/urn:section/urn:entry/urn:encounter[urn:code/@code='HOME']/urn:performer/urn:assignedEntity/urn:addr"/>
							</span>
						</xsl:when>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<xsl:choose>
						<xsl:when test="$encounterType='stat' or $encounterType='birth'">
							<span class="rowTitle">Haiglast lahkumise viis</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:dischargeDispositionCode[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.33']/@displayName"/>
							</span>
						</xsl:when>
					</xsl:choose>
				</td>
			</tr>
			<!-- Directed to info -->
			<xsl:apply-templates select="../../urn:component/urn:structuredBody/urn:component/urn:section/urn:entry/urn:encounter[urn:code/@code='NXT']/urn:performer/urn:assignedEntity/urn:representedOrganization" mode="directedTo"/>
		</table>
	</xsl:template>
	<!--

	Template for related encounters in subdivisions
	Wide table format
	-->
	<xsl:template name="relatedEncountersWide">
		<table>
			<tr>
				<td colspan="5" class="blockLabel">Osakondades viibimine </td>
			</tr>
			<tr class="rowTitle">
				<th>Kliinik</th>
				<th>Osakond</th>
				<th>Voodiprofiil</th>
				<th>Saabus</th>
				<th>Lahkus</th>
				<xsl:if test="../../urn:component/urn:structuredBody/urn:component/urn:section/urn:entry/urn:encounter/ext:encounter/ext:lengthOfStayQuantity/@value">
					<th>Voodipäevi</th>
				</xsl:if>
			</tr>
			<xsl:for-each select="../../urn:component/urn:structuredBody/urn:component/urn:section/urn:entry/urn:encounter">
				<tr class="rowValue">
					<xsl:apply-templates select="urn:performer/urn:assignedEntity/urn:representedOrganization" mode="relatedEncounter"/>
					<td class="dataTableCell">
						<xsl:value-of select="urn:performer/urn:assignedEntity/ext:asLicencedEntity/ext:id/@extension"/>
					</td>
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:low/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:high/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</td>
					<xsl:if test="ext:encounter/ext:lengthOfStayQuantity/@value">
						<td class="dataTableCell">
							<xsl:value-of select="ext:encounter/ext:lengthOfStayQuantity/@value"/>
						</td>
					</xsl:if>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for related encounters in subdivisions
	Narrow table format
	-->
	<xsl:template name="relatedEncountersNarrow">
		<xsl:param name="encounterType"/>
		<table>
			<tr>
				<td colspan="2" class="blockLabel">Külastused</td>
			</tr>
			<tr class="rowTitle">
				<xsl:if test="$encounterType='amb' or $encounterType='day'">
					<th>Visiidi kuupäev</th>
				</xsl:if>
				<xsl:if test="$encounterType='amb' or $encounterType='statAmb'">
					<th>Pöördumise erakorralisus</th>
					<th>Tüüp</th>
					<th>Liik</th>
				</xsl:if>
				<xsl:if test="$encounterType='statAmb'">
					<th>Visiitide arv</th>
				</xsl:if>
			</tr>
			<xsl:for-each select="../../urn:component/urn:structuredBody/urn:component/urn:section/urn:entry/urn:encounter[urn:code/@code='AMB' or urn:code/@code='DAY']">
				<tr class="rowValue">
					<xsl:if test="$encounterType='amb' or $encounterType='day'">
						<td class="dataTableCell">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
							</xsl:call-template>
						</td>
					</xsl:if>
					<xsl:if test="$encounterType='amb' or $encounterType='statAmb'">
						<td class="dataTableCell">
							<!-- pöördumise erakorralisus-->
							<xsl:value-of select="urn:priorityCode/@code"/>
							<xsl:text> - </xsl:text>
							<xsl:value-of select="urn:priorityCode/@displayName"/>
						</td>
						<td class="dataTableCell">
							<!-- visiidi tüüp-->
							<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.32']/@code"/>
							<xsl:text> - </xsl:text>
							<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.32']/@displayName"/>
						</td>
						<td class="dataTableCell">
							<!-- visiidi liik-->
							<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.30']/@code"/>
							<xsl:text> - </xsl:text>
							<xsl:value-of select="urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.30']/@displayName"/>
						</td>
					</xsl:if>
					<xsl:if test="$encounterType='statAmb'">
						<td class="dataTableCell">
							<!-- visiitide arv-->
							<xsl:value-of select="ext:encounter/ext:lengthOfStayQuantity/@value"/>
						</td>
					</xsl:if>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for department and subdepartment info
	-->
	<xsl:template name="asOrganizationPartOf.relatedEncounter" match="urn:representedOrganization" mode="relatedEncounter">
		<xsl:if test="../../../../urn:encounter/urn:code[@code='STAT' or @code='DAY']">
			<td class="dataTableCell">
				<xsl:value-of select="urn:asOrganizationPartOf/urn:wholeOrganization/urn:name"/>
			</td>
			<td class="dataTableCell">
				<xsl:value-of select="urn:name"/>
			</td>
		</xsl:if>
	</xsl:template>
	<!--

	Template for directedTo company info
	-->
	<xsl:template name="representedOrganization.directedTo" match="urn:representedOrganization" mode="directedTo">
		<tr>
			<td colspan="3">
				<span class="blockLabel">Suunati</span>
				<xsl:text> </xsl:text>
				<span class="rowValue">
					<xsl:value-of select="urn:name"/>
				</span>
			</td>
		</tr>
		<xsl:if test="urn:id">
			<tr>
				<td colspan="3">
					<span class="rowTitle">Registreerimiskood</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:id[@root='1.3.6.1.4.1.28284.4']/@extension"/>
					</span>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="../../../urn:effectiveTime">
			<tr>
				<td>
					<span class="rowTitle">Suunamise kuupäev</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="../../../urn:effectiveTime/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--


	Template for death section info
	-->
	<xsl:template name="section.death" match="urn:section" mode="death">
		<table>
			<tr>
				<td>
					<span class="blockLabel">
						<xsl:value-of select="urn:title"/>
					</span>
				</td>
			</tr>
			<xsl:if test="urn:entry/urn:act[urn:code/@code='DEATHDOC']/urn:reference/urn:externalDocument/urn:id">
				<tr>
					<td colspan="2">
						<span class="rowTitle">Teatise number</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:value-of select="urn:entry/urn:act[urn:code/@code='DEATHDOC']/urn:reference/urn:externalDocument/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.5']/@extension"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td>
					<span class="rowTitle">Surma aeg</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:entry/urn:act/urn:entryRelationship/urn:act[urn:code/@code='DEATH']/urn:effectiveTime/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
				<xsl:if test="urn:entry/urn:act[urn:code/@code='DEATHDOC']/urn:effectiveTime">
					<td colspan="2">
						<span class="rowTitle">Vormistamise kuupäev</span>
						<xsl:text> </xsl:text>
						<span class="rowValue">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:entry/urn:act[urn:code/@code='DEATHDOC']/urn:effectiveTime/@value"/>
							</xsl:call-template>
						</span>
					</td>
				</xsl:if>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for patient condition
	-->
	<xsl:template name="section.state" match="urn:section" mode="state">
		<table>
			<tr>
				<td>
					<span class="blockLabel">
						<xsl:value-of select="urn:title"/>
					</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:entry/urn:observation/urn:value/@code"/>
					</span>
					<xsl:text> - </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:entry/urn:observation/urn:value/@displayName"/>
					</span>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:text">
						<tr>
							<td class="blockLabel">
								<xsl:value-of select="urn:text/urn:paragraph/urn:caption"/>
							</td>
						</tr>
						<tr>
							<td class="rowValue">
								<xsl:value-of select="urn:text/urn:paragraph/urn:content"/>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for common info
	-->
	<xsl:template name="section.info" match="urn:section" mode="info">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:for-each select="urn:text/urn:paragraph/urn:content">
				<tr>
					<td class="rowValue">
						<xsl:value-of select="."/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for Nursingsummary
	-->
	<xsl:template name="section.nursingSummary" match="urn:section" mode="nursingSummary">
		<table>
			<xsl:for-each select="urn:text/urn:paragraph">
				<tr>
					<td class="rowTitle" width="20%">
						<xsl:value-of select="urn:caption"/>
					</td>
					<td class="rowValue" width="80%">
						<xsl:value-of select="urn:content"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for work reccomendations
	-->
	<xsl:template name="section.work" match="urn:section" mode="work">
		<table>
			<tr>
				<td colspan="5" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Liik</th>
						<th>Põhjus</th>
						<th>Vajadus</th>
						<th>Alates</th>
						<th>Kuni</th>
					</tr>
					<xsl:for-each select="urn:entry/urn:observation">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:value-of select="urn:interpretationCode/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.30' or substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.28']/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.31' or substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.29']/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/urn:low/@value"/>
								</xsl:call-template>
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/urn:high/@value"/>
								</xsl:call-template>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for documents
	-->
	<xsl:template name="section.documents" match="urn:section" mode="documents">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<xsl:call-template name="ciw"/>
						</td>
					</tr>
					<tr>
						<td>
							<xsl:call-template name="info"/>
						</td>
					</tr>
					<tr>
						<td>
							<xsl:call-template name="condition"/>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	template for CIW-s
	-->
	<xsl:template name="ciw">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">Töövõimetuslehed</td>
			</tr>
			<tr class="rowTitle">
				<th>TVL Liik</th>
				<th>Number</th>
				<th>Algus</th>
				<th>lõpp</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code='CIW']">
				<xsl:variable name="rowNum" select="count(urn:entryRelationship/urn:act/urn:code[@code='CIWPER'])"/>
				<xsl:for-each select="urn:entryRelationship/urn:act[urn:code/@code='CIWPER']">
					<xsl:choose>
						<xsl:when test="position()=1">
							<tr class="rowValue">
								<td class="dataTableCell" rowspan="{$rowNum}">
									<xsl:value-of select="../../urn:reference/urn:externalDocument/urn:code/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.14']/@displayName"/>
								</td>
								<td class="dataTableCell">
									<xsl:attribute name="rowspan"><xsl:value-of select="$rowNum"/></xsl:attribute>
									<xsl:value-of select="../../urn:reference/urn:externalDocument/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.8']/@extension"/>
								</td>
								<xsl:apply-templates select="urn:effectiveTime" mode="ciw"/>
							</tr>
						</xsl:when>
						<xsl:otherwise>
							<tr class="rowValue">
								<xsl:apply-templates select="urn:effectiveTime" mode="ciw"/>
							</tr>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:for-each>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

	Template for displaying ciw start and end dates
	-->
	<xsl:template name="effectiveTime.ciw" match="urn:effectiveTime" mode="ciw">
		<td class="dataTableCell">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:low/@value"/>
			</xsl:call-template>
		</td>
		<td class="dataTableCell">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:high/@value"/>
			</xsl:call-template>
		</td>
	</xsl:template>
	<!--

	Template for information documents
	-->
	<xsl:template name="info">
		<table>
			<tr>
				<td colspan="3" class="blockLabel">Teatised</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Number</th>
				<th>Nimetus</th>
				<th>Väljastatud</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code='INFO']">
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:reference/urn:externalDocument/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.6']/@extension"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:reference/urn:externalDocument/urn:code[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.2.2']/urn:originalText"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:participant/urn:participantRole/urn:playingEntity/urn:name"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!-- 

	Template for patient condition documents
	-->
	<xsl:template name="condition">
		<table>
			<tr>
				<td class="blockLabel">Terviseseisundi kirjeldus</td>
			</tr>
			<tr>
				<td class="rowValue">
					<xsl:value-of select="urn:entry/urn:act[urn:code/@code='HEALTH']/urn:text"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for ambulatory directed from info
	-->
	<xsl:template name="section.ambRef" match="urn:section" mode="ambRef">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:entry/urn:encounter/urn:effectiveTime">
						<tr>
							<td>
								<span class="rowTitle">Aeg</span>
								<xsl:text> </xsl:text>
								<span class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</span>
							</td>
						</tr>
					</xsl:if>
					<tr>
						<td class="blockLabel">
							<xsl:value-of select="urn:text/urn:paragraph/urn:caption"/>
						</td>
					</tr>
					<tr>
						<td class="rowValue">
							<xsl:value-of select="urn:text/urn:paragraph/urn:content"/>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for anamnesisAll
	-->
	<xsl:template name="section.anamnesisAll" match="urn:section" mode="anamnesisAll">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:choose>
						<xsl:when test="urn:entry/urn:encounter/urn:effectiveTime/urn:low">
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/urn:low/@value"/>
							</xsl:call-template>
							<xsl:text> - </xsl:text>
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/urn:high/@value"/>
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="dateFormat">
								<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/@value"/>
							</xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:text> vanusegrupp: </xsl:text>
					<xsl:value-of select="urn:entry/urn:encounter/urn:code/urn:qualifier/urn:value/@displayName"/>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:apply-templates select="." mode="text"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for XML xformatted text rows
	-->
	<xsl:template match="urn:text" mode="row">
		<tr>
			<td>
				<xsl:apply-templates select="." mode="text"/>
			</td>
		</tr>
	</xsl:template>
	<!--

	Template for death common info
	-->
	<xsl:template name="section.deathGeneral" match="urn:section" mode="deathGeneral">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<span class="rowTitle">Surmaaeg</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:entry/urn:act/urn:effectiveTime/@value"/>
									<xsl:with-param name="format" select="'time'"/>
								</xsl:call-template>
							</span>
						</td>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:act/urn:entryRelationship/urn:observation/urn:interpretationCode/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:act/urn:entryRelationship/urn:observation/urn:value/@displayName"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:act/urn:participant[@typeCode='ORG']/urn:participantRole/urn:code/@displayName"/>
								<xsl:text> (</xsl:text>
								<xsl:value-of select="urn:entry/urn:act/urn:participant[@typeCode='ORG']/urn:participantRole/urn:playingEntity/urn:code/@displayName"/>
								<xsl:text>) </xsl:text>
							</span>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:act/urn:participant[@typeCode='ORG']/urn:participantRole/urn:playingEntity/urn:name/text()"/>
							</span>
						</td>
						<td>
							<span class="rowTitle">Registrinumber / isikukood</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:act/urn:participant[@typeCode='ORG']/urn:participantRole/urn:id/@extension"/>
							</span>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<span class="rowTitle">Surma geograafiline koht</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:apply-templates select="urn:entry/urn:act/urn:participant[@typeCode='LOC']/urn:participantRole/urn:addr"/>
							</span>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for death causes common info
	-->
	<xsl:template name="section.deathCausesGeneral" match="urn:section" mode="deathCausesGeneral">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCASSG']/urn:interpretationCode/@displayName"/>
							</span>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCASSG']/urn:value/@displayName"/>
							</span>
						</td>
					</tr>
					<xsl:if test="urn:entry/urn:observation/urn:reference">
						<tr>
							<td>
								<span class="rowTitle">
									<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCASSG']/urn:reference/urn:externalDocument/urn:code/@displayName"/>
								</span>
								<span class="rowValue">
									<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCASSG']/urn:reference/urn:externalDocument/urn:id/@extension"/>
								</span>
							</td>
						</tr>
					</xsl:if>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCAUSED']/urn:interpretationCode/@displayName"/>
							</span>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:interpretationCode/@code='DCAUSED']/urn:value/@displayName"/>
							</span>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Teplate for death causes
	-->
	<xsl:template name="section.deathCauses" match="urn:section" mode="deathCauses">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation">
						<tr>
							<td>
								<table>
									<tr>
										<td>
											<span class="blockLabel">
												<xsl:value-of select="urn:interpretationCode/@displayName"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<xsl:call-template name="diagnoses">
												<xsl:with-param name="list" select="."/>
												<xsl:with-param name="showRecurrency" select="'yes'"/>
												<xsl:with-param name="codeSystemName" select="'ICD-10'"/>
											</xsl:call-template>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for organ donoring
	-->
	<xsl:template name="section.donor" match="urn:section" mode="donor">
		<table>
			<tr>
				<td class="blockLabel" colspan="5">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Jah/ei</th>
						<th>Elund</th>
						<th>Elundi eemaldamise aeg </th>
						<th>Protokolli nr </th>
						<th>Protokolli kuupäev </th>
					</tr>
					<xsl:for-each select="urn:entry/urn:observation">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:value-of select="urn:value/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:entryRelationship/urn:procedure/urn:targetSiteCode/@displayName"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:entryRelationship/urn:procedure/urn:targetSiteCode/@code"/>
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:entryRelationship/urn:procedure/urn:effectiveTime/@value"/>
									<xsl:with-param name="format" select="'time'"/>
								</xsl:call-template>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:entryRelationship/urn:procedure/urn:reference/urn:externalDocument/urn:id[@root='ElundiProtokoll']/@extension"/>
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:entryRelationship/urn:procedure/urn:precondition/urn:criterion/urn:value/@value"/>
								</xsl:call-template>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for other important info
	-->
	<xsl:template name="section.otherInfo" match="urn:section" mode="otherInfo">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<table>
								<tr class="rowTitle">
									<th>
										<strong>Aparaat</strong>
									</th>
									<th>Paigaldamise aeg </th>
									<th>Paigaldamise koht</th>
									<xsl:if test="urn:entry/urn:observation/urn:author">
										<th>Allikas</th>
									</xsl:if>
								</tr>
								<xsl:for-each select="urn:entry/urn:observation">
									<tr class="rowValue">
										<td class="dataTableCell">
											<xsl:value-of select="urn:value/@displayName"/>
											<!--Alternatiivkoodid-->
											<xsl:for-each select="urn:value/urn:translation">
												<br/>
												<xsl:apply-templates select="." mode="formatting">
													<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
												</xsl:apply-templates>
												<br/>
											</xsl:for-each>
										</td>
										<td class="dataTableCell">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:entryRelationship/urn:procedure/urn:effectiveTime/@value"/>
											</xsl:call-template>
										</td>
										<td class="dataTableCell">
											<xsl:value-of select="urn:entryRelationship/urn:procedure/urn:targetSiteCode/@displayName"/>
										</td>
										<xsl:if test="urn:author">
											<td class="dataTableCell">
												<xsl:call-template name="timeCriticalSourceAuthor">
													<xsl:with-param name="tabel" select="'Jah'"/>
												</xsl:call-template>
											</td>
										</xsl:if>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--

	Template for outer reasons
	-->
	<xsl:template name="section.outerReasons" match="urn:section" mode="outerReasons">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<span class="rowTitle">Välispõhjuse tekke aeg</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:entry/urn:act[urn:code/@code='OUT']/urn:effectiveTime/@value"/>
								</xsl:call-template>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:act[urn:code/@code='OUT']/urn:participant/urn:participantRole/urn:code/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:apply-templates select="urn:entry/urn:act[urn:code/@code='OUT']/urn:participant/urn:participantRole/urn:addr"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:act[urn:code/@code='OUT']/urn:entryRelationship/urn:observation/urn:interpretationCode[@code='ALC']/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:act[urn:code/@code='OUT']/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='ALC']/urn:value/@displayName"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:act[urn:code/@code='OUT']/urn:entryRelationship/urn:observation/urn:interpretationCode[@code='DRUG']/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:act[urn:code/@code='OUT']/urn:entryRelationship/urn:observation[urn:interpretationCode/@code='DRUG']/urn:value/@displayName"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:observation/urn:interpretationCode[@code='OUTERPL']/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:text> ICD-10: </xsl:text>
								<xsl:apply-templates select="urn:entry/urn:observation[urn:interpretationCode/@code='OUTERPL']/urn:value[@codeSystemName='ICD-10']" mode="formatting"/>
								<xsl:text>; IDB: </xsl:text>
								<xsl:apply-templates select="urn:entry/urn:observation[urn:interpretationCode/@code='OUTERPL']/urn:value[@codeSystemName='IDB']" mode="formatting"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">
								<xsl:value-of select="urn:entry/urn:observation/urn:interpretationCode[@code='OUTERACT']/@displayName"/>
							</span>
							<xsl:text> </xsl:text>
							<span class="rowValue">
								<xsl:text> ICD-10: </xsl:text>
								<xsl:apply-templates select="urn:entry/urn:observation[urn:interpretationCode/@code='OUTERACT']/urn:value[@codeSystemName='ICD-10']" mode="formatting"/>
								<xsl:text>; IDB: </xsl:text>
								<xsl:apply-templates select="urn:entry/urn:observation[urn:interpretationCode/@code='OUTERACT']/urn:value[@codeSystemName='IDB']" mode="formatting"/>
							</span>
						</td>
					</tr>
					<tr>
						<td>
							<span class="rowTitle">Asjaolud</span>
							<br/>
							<xsl:apply-templates select="urn:text" mode="text"/>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
Template for trustperson detail info
	-->
	<xsl:template name="act.trustPerson" match="urn:section" mode="trustPerson">
		<table>
			<xsl:choose>
				<xsl:when test="urn:entry/urn:act/urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.34']/@code='0'">
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:text>Mina, </xsl:text>
							<xsl:value-of select="//urn:author/urn:assignedAuthor/urn:assignedPerson/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:author/urn:assignedAuthor/urn:assignedPerson/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text> tühistan</xsl:text>
						</td>
					</tr>
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:text>usaldusisiku </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:guardian/urn:guardianPerson/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:guardian/urn:guardianPerson/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text>volitused teostada Digitaalse terviseloo infosüsteemis </xsl:text>
						</td>
					</tr>
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:text>patsiendi </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text>nimel õigusi. Volituse ulatus: </xsl:text>
						</td>
					</tr>
					<xsl:for-each select="urn:entry/urn:act">
						<tr>
							<td class="rowValue">
								<xsl:value-of select="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.34']/@code"/>
								<xsl:text> - </xsl:text>
							</td>
							<td class="rowValue">
								<xsl:value-of select="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.34']/@displayName"/>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:text>Mina, </xsl:text>
							<xsl:value-of select="//urn:author/urn:assignedAuthor/urn:assignedPerson/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:author/urn:assignedAuthor/urn:assignedPerson/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text> volitan </xsl:text>
						</td>
					</tr>
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:text>patsiendi </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text>usaldusisikuks isiku </xsl:text>
						</td>
					</tr>
					<tr>
						<td class="blockLabel" colspan="2">
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:guardian/urn:guardianPerson/urn:name/urn:given"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="//urn:recordTarget/urn:patientRole/urn:patient/urn:guardian/urn:guardianPerson/urn:name/urn:family"/>
							<xsl:text> </xsl:text>
							<xsl:text> volituse ulatusega: </xsl:text>
						</td>
					</tr>
					<xsl:for-each select="urn:entry/urn:act">
						<tr>
							<td class="rowValue">
								<xsl:value-of select="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.34']/@code"/>
								<xsl:text> - </xsl:text>
							</td>
							<td class="rowValue">
								<xsl:value-of select="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.34']/@displayName"/>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	



Template for physical examination
	-->
	<xsl:template name="section.phys" match="urn:section" mode="phys">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="5">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Vanusegrupp</th>
				<th>Läbivaatus</th>
				<th>Tulemus</th>
				<th>Täpsustus vabatekstina</th>
				<th>RHK-10</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/@displayName"/>
						<br/>
					</td>
					<td class="dataTableCell">
						<table>
							<xsl:for-each select="urn:value">
								<tr>
									<td>
										<xsl:value-of select="@displayName"/>
										<xsl:if test="@value">
											<xsl:value-of select="@value"/>
										</xsl:if>
										<xsl:if test="urn:low or urn:high">
											<xsl:value-of select="urn:low/@value"/>
											<xsl:text> - </xsl:text>
											<xsl:value-of select="urn:high/@value"/>
										</xsl:if>
									</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/urn:originalText"/>
						<xsl:for-each select="urn:value">
							<xsl:value-of select="urn:originalText"/>
						</xsl:for-each>
						<br/>
						<br/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@code"/>
						<xsl:text> - </xsl:text>
						<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@displayName"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
Template for progress examination
	-->
	<xsl:template name="section.progress" match="urn:section" mode="progress">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="5">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Vanusegrupp</th>
				<th>Arengu hindamine</th>
				<th>Tulemus</th>
				<th>Täpsustus</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
					<td class="dataTableCell">
						<xsl:choose>
							<xsl:when test="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.37']">
								<xsl:value-of select="urn:code/@displayName"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="urn:code/@codeSystemName"/>
							</xsl:otherwise>
						</xsl:choose>
					</td>
					<td class="dataTableCell">
						<xsl:choose>
							<xsl:when test="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.37']">
								<xsl:call-template name="negation"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="urn:code/@displayName"/>
							</xsl:otherwise>
						</xsl:choose>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/urn:originalText"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	Template for Negation
	-->
	<xsl:template name="negation" match="urn:observation" mode="negation">
		<xsl:choose>
			<xsl:when test="@negationInd='true'">
				<xsl:text>ei</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>jah</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--
Template for guidance
	-->
	<xsl:template name="section.guidance" match="urn:section" mode="guidance">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="3">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Toimumise kuupäev</th>
				<th>Vanusegrupp</th>
				<th>Nõustamine</th>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:act[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/@displayName"/>
								<xsl:if test="urn:code/urn:originalText">
									<xsl:text>: </xsl:text>
									<xsl:value-of select="urn:code/urn:originalText"/>
								</xsl:if>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
Template for guidanceGeneral
	-->
	<xsl:template name="section.guidanceGeneral" match="urn:section" mode="guidanceGeneral">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Hindamise kuupäev</th>
				<th>Vanusegrupp</th>
				<th>Liik</th>
				<th>Tulemus</th>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:value"/>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for growthAll
	-->
	<xsl:template name="section.growthAll" match="urn:section" mode="growthAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Pikkus-->
			<tr>
				<td class="rowTitle">Pikkus (cm)</td>
				<xsl:call-template name="observationData">
					<!--<xsl:with-param name="healthcontrolType" select="'LENGTH'"/>-->
					<xsl:with-param name="healthcontrolType" select="'50373000'"/>
				</xsl:call-template>
			</tr>
			<!-- Kaal-->
			<tr>
				<td class="rowTitle">Kaal (g)</td>
				<xsl:call-template name="observationData">
					<!--<xsl:with-param name="healthcontrolType" select="'WEIGTH'"/>-->
					<xsl:with-param name="healthcontrolType" select="'363809009'"/>
				</xsl:call-template>
			</tr>
			<!-- Peaümbermõõt-->
			<tr>
				<td class="rowTitle">Peaümbermõõt (cm)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'HPM'"/>
				</xsl:call-template>
			</tr>
			<!--Suur lõge-->
			<tr>
				<td class="rowTitle">Suure lõge pikkus x laius (cm)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'BLFONTANEL'"/>
				</xsl:call-template>
			</tr>
			<!--KMI-->
			<tr>
				<td class="rowTitle">KMI</td>
				<xsl:call-template name="observationData">
					<!--<xsl:with-param name="healthcontrolType" select="'KMI'"/>-->
					<xsl:with-param name="healthcontrolType" select="'60621009'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for guidanceAll
	-->
	<xsl:template name="section.guidanceAll" match="urn:section" mode="guidanceAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Hooldamine-->
			<tr>
				<td class="rowTitle">Hooldamine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'1'"/>
				</xsl:call-template>
			</tr>
			<!-- Imiku, väikelapse toitmine, toitumine-->
			<tr>
				<td class="rowTitle">Imiku, väikelapse toitmine, toitumine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'2'"/>
				</xsl:call-template>
			</tr>
			<!--Rinnaga toitmine-->
			<tr>
				<td class="rowTitle">Rinnaga toitmine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'3'"/>
				</xsl:call-template>
			</tr>
			<!-- Õnnetuste vältimine-->
			<tr>
				<td class="rowTitle">Õnnetuste vältimine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'4'"/>
				</xsl:call-template>
			</tr>
			<!--Rahhiidi prof-->
			<tr>
				<td class="rowTitle">Rahhiidi prof</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'5'"/>
				</xsl:call-template>
			</tr>
			<!--Sõeltestide tulemused-->
			<tr>
				<td class="rowTitle">Sõeltestide tulemused</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'6'"/>
				</xsl:call-template>
			</tr>
			<!--Rahutu imikuga toimetulek-->
			<tr>
				<td class="rowTitle">Rahutu imikuga toimetulek</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'7'"/>
				</xsl:call-template>
			</tr>
			<!--Potireziimi õpetus-->
			<tr>
				<td class="rowTitle">Potireziimi õpetus</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'8'"/>
				</xsl:call-template>
			</tr>
			<!--Hammaste seisundi kontroll, suuhügieeni õpetus-->
			<tr>
				<td class="rowTitle">Hammaste seisundi kontroll, suuhügieeni õpetus</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'9'"/>
				</xsl:call-template>
			</tr>
			<!--Isiklik hügieen-->
			<tr>
				<td class="rowTitle">Isiklik hügieen</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'10'"/>
				</xsl:call-template>
			</tr>
			<!--Päevareziim-->
			<tr>
				<td class="rowTitle">Päevareziim</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'11'"/>
				</xsl:call-template>
			</tr>
			<!--Toitumine-->
			<tr>
				<td class="rowTitle">-Toitumine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'12'"/>
				</xsl:call-template>
			</tr>
			<!--Nägemise tervishoid-->
			<tr>
				<td class="rowTitle">Nägemise tervishoid</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'13'"/>
				</xsl:call-template>
			</tr>
			<!--Silmaarstile suunamine-->
			<tr>
				<td class="rowTitle">Silmaarstile suunamine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'14'"/>
				</xsl:call-template>
			</tr>
			<!--Füüsiline aktiivsus-->
			<tr>
				<td class="rowTitle">Füüsiline aktiivsus</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'15'"/>
				</xsl:call-template>
			</tr>
			<!--Riskikäitumine(küsimustikud: narko, suguelu, kodu-, kooli- vägivald)-->
			<tr>
				<td class="rowTitle">Riskikäitumine(küsimustikud: narko, suguelu, kodu-, kooli- vägivald)</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'16'"/>
				</xsl:call-template>
			</tr>
			<!--Traumad ja õnnetusjuhtumid-->
			<tr>
				<td class="rowTitle">Traumad ja õnnetusjuhtumid</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'17'"/>
				</xsl:call-template>
			</tr>
			<!--Seksuaalnõustamine-->
			<tr>
				<td class="rowTitle">Seksuaalnõustamine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'18'"/>
				</xsl:call-template>
			</tr>
			<!--Pereplaneerimine-->
			<tr>
				<td class="rowTitle">Pereplaneerimine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'19'"/>
				</xsl:call-template>
			</tr>
			<!--Kutsealane nõustamine-->
			<tr>
				<td class="rowTitle">Kutsealane nõustamine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'20'"/>
				</xsl:call-template>
			</tr>
			<!--Psühhosotsiaalne käitumine-->
			<tr>
				<td class="rowTitle">Psühhosotsiaalne käitumine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'21'"/>
				</xsl:call-template>
			</tr>
			<!--Kutsealane nõustamine-->
			<tr>
				<td class="rowTitle">Kutsealane nõustamine</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'22'"/>
				</xsl:call-template>
			</tr>
			<!--Soovitus silmaarsti konsultatsioonile pöördumiseks-->
			<tr>
				<td class="rowTitle">Soovitus silmaarsti konsultatsioonile pöördumiseks</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'23'"/>
				</xsl:call-template>
			</tr>
			<!--Kuulmise sõeltestimine ehk OAE-->
			<tr>
				<td class="rowTitle">Kuulmise sõeltestimine ehk OAE</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'24'"/>
				</xsl:call-template>
			</tr>
			<!--Muu-->
			<tr>
				<td class="rowTitle">Muu</td>
				<xsl:call-template name="actData">
					<xsl:with-param name="healthcontrolType" select="'0'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for familyAll
Tervisekaardil: pere olukord vanusegruppidena
	-->
	<xsl:template name="section.familyAll" match="urn:section" mode="familyAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Pere koosseis-->
			<tr>
				<td class="rowTitle">Pere koosseis</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'1'"/>
				</xsl:call-template>
			</tr>
			<!-- Sotsiaalne taust-->
			<tr>
				<td class="rowTitle">Sotsiaalne taust</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'2'"/>
				</xsl:call-template>
			</tr>
			<!--Kolimised-->
			<tr>
				<td class="rowTitle">Kolimised</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'3'"/>
				</xsl:call-template>
			</tr>
			<!-- Töölerakendumine-->
			<tr>
				<td class="rowTitle">Töölerakendumine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'4'"/>
				</xsl:call-template>
			</tr>
			<!--Inimsuhted-->
			<tr>
				<td class="rowTitle">Inimsuhted</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'5'"/>
				</xsl:call-template>
			</tr>
			<!--Kroonilised haigused perekonnas-->
			<tr>
				<td class="rowTitle">Kroonilised haigused perekonnas</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'6'"/>
				</xsl:call-template>
			</tr>
			<!--Lapse päevahoid-->
			<tr>
				<td class="rowTitle">Lapse päevahoid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'7'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for customAll
Tervisekaardil: terviseharjumused vanusegruppidena
	-->
	<xsl:template name="section.customAll" match="urn:section" mode="customAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Tervislik toitumine-->
			<tr>
				<td class="rowTitle">Tervislik toitumine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'1'"/>
				</xsl:call-template>
			</tr>
			<!-- Alkoholi tarvitamine-->
			<tr>
				<td class="rowTitle">Alkoholi tarvitamine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'2'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for psyhsocAll
Tervisekaardil: Psühhosotsiaalne taust ja areng vanusegruppidena
	-->
	<xsl:template name="section.psyhsocAll" match="urn:section" mode="psyhsocAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Kaaslased-->
			<tr>
				<td class="rowTitle">Kaaslased</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'1'"/>
				</xsl:call-template>
			</tr>
			<!-- Harrastused-->
			<tr>
				<td class="rowTitle">Harrastused</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'2'"/>
				</xsl:call-template>
			</tr>
			<!--Uni-->
			<tr>
				<td class="rowTitle">Uni</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'3'"/>
				</xsl:call-template>
			</tr>
			<!-- TV-vaatamine-->
			<tr>
				<td class="rowTitle">TV-vaatamine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'4'"/>
				</xsl:call-template>
			</tr>
			<!--arvutiga tegevus-->
			<tr>
				<td class="rowTitle">Arvutiga tegevus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'5'"/>
				</xsl:call-template>
			</tr>
			<!--Söömine-->
			<tr>
				<td class="rowTitle">Söömine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'6'"/>
				</xsl:call-template>
			</tr>
			<!--Riietumine-->
			<tr>
				<td class="rowTitle">Riietumine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'7'"/>
				</xsl:call-template>
			</tr>
			<!-- Kohanemine eelkoolis (lasteaias esiõpetuse andmine 6-aastastele-->
			<tr>
				<td class="rowTitle">Kohanemine eelkoolis (lasteaias esiõpetuse andmine 6-aastastele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'8'"/>
				</xsl:call-template>
			</tr>
			<!--HKäitumine-->
			<tr>
				<td class="rowTitle">Käitumine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'9'"/>
				</xsl:call-template>
			</tr>
			<!--Kontakteerumisvõime-->
			<tr>
				<td class="rowTitle">Kontakteerumisvõime</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'10'"/>
				</xsl:call-template>
			</tr>
			<!--Keskendumisvõime-->
			<tr>
				<td class="rowTitle">Keskendumisvõime</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'11'"/>
				</xsl:call-template>
			</tr>
			<!--Kurvameelsus-->
			<tr>
				<td class="rowTitle">Kurvameelsus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'12'"/>
				</xsl:call-template>
			</tr>
			<!--Rahutus-->
			<tr>
				<td class="rowTitle">Rahutus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'13'"/>
				</xsl:call-template>
			</tr>
			<!--Tikid-->
			<tr>
				<td class="rowTitle">Tikid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'14'"/>
				</xsl:call-template>
			</tr>
			<!--Argus-->
			<tr>
				<td class="rowTitle">Argus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'15'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for mentalAll
Tervisekaardil: Vaimne taust ja areng vanusegruppidena
	-->
	<xsl:template name="section.mentalAll" match="urn:section" mode="mentalAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Edukus eelkoolis-->
			<tr>
				<td class="rowTitle">Edukus eelkoolis</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'1'"/>
				</xsl:call-template>
			</tr>
			<!-- Kooliküpsus-->
			<tr>
				<td class="rowTitle">Kooliküpsus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'2'"/>
				</xsl:call-template>
			</tr>
			<!--Testide tulemused-->
			<tr>
				<td class="rowTitle">Testide tulemused</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'3'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for physAll
Tervisekaardil: Läbivaatus vanusegruppidena
	-->
	<xsl:template name="section.physAll" match="urn:section" mode="physAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Seisund väljakirjutamisel-->
			<tr>
				<td class="rowTitle">Seisund väljakirjutamisel</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'BSTATE'"/>
				</xsl:call-template>
			</tr>
			<!-- Üldseisund-->
			<tr>
				<td class="rowTitle">Üldseisund</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'STATE'"/>
				</xsl:call-template>
			</tr>
			<!--Nabaväädi köndi seisund-->
			<tr>
				<td class="rowTitle">Nabaväädi köndi seisund</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'UMBSTAT'"/>
				</xsl:call-template>
			</tr>
			<!--Toitmine-->
			<tr>
				<td class="rowTitle">Toitmine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'FEED'"/>
				</xsl:call-template>
			</tr>
			<!-- Lõge-->
			<tr>
				<td class="rowTitle">Lõge</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'FONTANEL'"/>
				</xsl:call-template>
			</tr>
			<!--Kraniotaabes-->
			<tr>
				<td class="rowTitle">Kraniotaabes</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'CRA'"/>
				</xsl:call-template>
			</tr>
			<!--Nahk ja limaskestad-->
			<tr>
				<td class="rowTitle">Nahk ja limaskestad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'SKIN'"/>
				</xsl:call-template>
			</tr>
			<!--Lümfisõlmed-->
			<tr>
				<td class="rowTitle">Lümfisõlmed</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'LYMPH'"/>
				</xsl:call-template>
			</tr>
			<!-- Süda-->
			<tr>
				<td class="rowTitle">Süda</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'HEART'"/>
				</xsl:call-template>
			</tr>
			<!--Kopsud-->
			<tr>
				<td class="rowTitle">Kopsud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'PULM'"/>
				</xsl:call-template>
			</tr>
			<!--Kõht-->
			<tr>
				<td class="rowTitle">Kõht</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'STOM'"/>
				</xsl:call-template>
			</tr>
			<!--Urogenitaalsüsteem-->
			<tr>
				<td class="rowTitle">Urogenitaalsüsteem</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'UROL'"/>
				</xsl:call-template>
			</tr>
			<!--Luu-, liiges-, lihaskond-->
			<tr>
				<td class="rowTitle">Luu-, liiges-, lihaskond</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'MUSC'"/>
				</xsl:call-template>
			</tr>
			<!--Rüht-->
			<tr>
				<td class="rowTitle">Rüht</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'POST'"/>
				</xsl:call-template>
			</tr>
			<!--Puusaliigesed-->
			<tr>
				<td class="rowTitle">Puusaliigesed</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'HIP'"/>
				</xsl:call-template>
			</tr>
			<!--Suuõõne - ja hammaskonna kontroll-->
			<tr>
				<td class="rowTitle">Suuõõne - ja hammaskonna kontroll</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'MCAV'"/>
				</xsl:call-template>
			</tr>
			<!--Muud patoloogiad-->
			<tr>
				<td class="rowTitle">Muud patoloogiad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'OTHERPAT'"/>
				</xsl:call-template>
			</tr>
			<!--Menarche-->
			<tr>
				<td class="rowTitle">Menarche</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'MENARCHE'"/>
				</xsl:call-template>
			</tr>
			<!--Rinnad-->
			<tr>
				<td class="rowTitle">Rinnad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'BREA'"/>
				</xsl:call-template>
			</tr>
			<!--Pubitaalkarvastik-->
			<tr>
				<td class="rowTitle">Pubitaalkarvastik</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="PEL"/>
				</xsl:call-template>
			</tr>
			<!--Rinnad-->
			<tr>
				<td class="rowTitle">Rinnad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'BREA'"/>
				</xsl:call-template>
			</tr>
			<!--Genitaalid-->
			<tr>
				<td class="rowTitle">Genitaalid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'GEN'"/>
				</xsl:call-template>
			</tr>
			<!--Menstruatsioon-->
			<tr>
				<td class="rowTitle">Menstruatsioon</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'248957007'"/>
				</xsl:call-template>
			</tr>
			<!--Menstruatsiooni regulaarsus-->
			<tr>
				<td class="rowTitle">Menstruatsiooni regulaarsus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'364307006'"/>
				</xsl:call-template>
			</tr>
			<!--Menstruatsiooni tsükli pikkus-->
			<tr>
				<td class="rowTitle">Menstruatsiooni tsükli pikkus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'364310004'"/>
				</xsl:call-template>
			</tr>
			<!--Vereerituse päevade arv-->
			<tr>
				<td class="rowTitle">Vereerituse päevade arv</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'161720007'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for progressAll
Tervisekaardil: Läbivaatus vanusegruppidena
	-->
	<xsl:template name="section.progressAll" match="urn:section" mode="progressAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- Üldmotoorika algus-->
			<tr>
				<th>Üldmotoorika</th>
			</tr>
			<!-- A01-->
			<tr>
				<td class="rowTitle"> A01 kõhuliasendis uurija käel tekib momendiks sirutus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A01'"/>
				</xsl:call-template>
			</tr>
			<!-- A02-->
			<tr>
				<td class="rowTitle"> A02 osaline sirutus - ei tõsta pead</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A02'"/>
				</xsl:call-template>
			</tr>
			<!-- A03-->
			<tr>
				<td class="rowTitle"> A03 osaline sirutus - ei tõsta jalgu</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A03'"/>
				</xsl:call-template>
			</tr>
			<!-- A04-->
			<tr>
				<td class="rowTitle"> A04 osaline sirutus - vajub külje suunas</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A04'"/>
				</xsl:call-template>
			</tr>
			<!-- A05-->
			<tr>
				<td class="rowTitle"> A05 sirutust ei teki ("märja pesu" sümptom)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A05'"/>
				</xsl:call-template>
			</tr>
			<!-- A06-->
			<tr>
				<td class="rowTitle"> A06 kindel pea tõstmine kõhuliasendist käsivarre toetusega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A06'"/>
				</xsl:call-template>
			</tr>
			<!-- A07-->
			<tr>
				<td class="rowTitle"> A07 asümmeetriline hoiak</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A07'"/>
				</xsl:call-template>
			</tr>
			<!--A08 -->
			<tr>
				<td class="rowTitle">A08 Ei hoia pead</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A08'"/>
				</xsl:call-template>
			</tr>
			<!-- A09-->
			<tr>
				<td class="rowTitle"> A09 kõhuliasendis uurija käel tekib momendiks sirutus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A09'"/>
				</xsl:call-template>
			</tr>
			<!-- A10-->
			<tr>
				<td class="rowTitle"> A10 istesse tõmbamisel vajub külje suunas</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A10'"/>
				</xsl:call-template>
			</tr>
			<!-- A11-->
			<tr>
				<td class="rowTitle"> A11 istesse tõmbamisel ei fikseeri pead 	</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A11'"/>
				</xsl:call-template>
			</tr>
			<!-- A12-->
			<tr>
				<td class="rowTitle"> A12 kõhuliasendis toetub sirgetele kätele, tõstes üles rindkere ja kõhu ülemise osa, jalad ja sääred tõstetud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A12'"/>
				</xsl:call-template>
			</tr>
			<!-- A13-->
			<tr>
				<td class="rowTitle"> A13 kõhuliasendis toetub käsivarrele kõhuliasendis</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A13'"/>
				</xsl:call-template>
			</tr>
			<!-- A14-->
			<tr>
				<td class="rowTitle"> A14 kõhuliasendis tõstab pead lühiajaliselt või üldse mitte</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A14'"/>
				</xsl:call-template>
			</tr>
			<!-- A15-->
			<tr>
				<td class="rowTitle"> A15 pöörab kõhuliasendist selili</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A15'"/>
				</xsl:call-template>
			</tr>
			<!--A16 -->
			<tr>
				<td class="rowTitle">A16 pöörab kõhuliasendist külili</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A16'"/>
				</xsl:call-template>
			</tr>
			<!-- A17-->
			<tr>
				<td class="rowTitle"> A17 ei pööra kõhuliasendist</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A17'"/>
				</xsl:call-template>
			</tr>
			<!-- A18-->
			<tr>
				<td class="rowTitle"> A18 tuleb ise istuma ja istub piiramatu aja</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A18'"/>
				</xsl:call-template>
			</tr>
			<!-- A19-->
			<tr>
				<td class="rowTitle"> A19 vajab istumisel käe(käte) toetust</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A19'"/>
				</xsl:call-template>
			</tr>
			<!-- A20-->
			<tr>
				<td class="rowTitle"> A20 ei istu</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A20'"/>
				</xsl:call-template>
			</tr>
			<!-- A21-->
			<tr>
				<td class="rowTitle"> A21 sseisab hästi ja piiramatu aja toe najal</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A21'"/>
				</xsl:call-template>
			</tr>
			<!-- A22-->
			<tr>
				<td class="rowTitle"> A22 seisab lühiajaliselt toe najal</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A22'"/>
				</xsl:call-template>
			</tr>
			<!-- A23-->
			<tr>
				<td class="rowTitle"> A23 ei seisa</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A23'"/>
				</xsl:call-template>
			</tr>
			<!--A24 -->
			<tr>
				<td class="rowTitle">A24 vaba kindel käik laiaulatusliku perfektse tasakaalukontrolliga ja koordineeritud käte tegevusega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A24'"/>
				</xsl:call-template>
			</tr>
			<!-- A25-->
			<tr>
				<td class="rowTitle"> A25 käimisel puudub kindlus, puudub käte koordineeritud tegevus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A25'"/>
				</xsl:call-template>
			</tr>
			<!-- A26-->
			<tr>
				<td class="rowTitle"> A26 ei käi iseseisvalt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A26'"/>
				</xsl:call-template>
			</tr>
			<!-- A27-->
			<tr>
				<td class="rowTitle"> A27 vaba jooks (jookseb ümber takistuse, ebatasasel pinnal, selg ees)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A27'"/>
				</xsl:call-template>
			</tr>
			<!-- A28-->
			<tr>
				<td class="rowTitle"> A28 jooks ebaühtlane</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A28'"/>
				</xsl:call-template>
			</tr>
			<!-- A29-->
			<tr>
				<td class="rowTitle"> A29 ei jookse</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A29'"/>
				</xsl:call-template>
			</tr>
			<!-- A30-->
			<tr>
				<td class="rowTitle"> A30 suudab seista ühel jalal lühiajaliselt abita, seisab ja käib varvastel ja kandadel, käib mööda joonistatud joont, hüppab koos jalgadega trepi alumiselt astmelt (parem, vasak eraldi)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A30'"/>
				</xsl:call-template>
			</tr>
			<!-- A31-->
			<tr>
				<td class="rowTitle"> A31 sooritab 2 komponenti neist: suudab seista ühel jalal lühiajaliselt abita, seisab ja käib varvastel ja kandadel, käib mööda joonistatud joont, hüppab koos jalgadega trepi valumiselt astmelt (parem, vasak eraldi)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A31'"/>
				</xsl:call-template>
			</tr>
			<!--A32 -->
			<tr>
				<td class="rowTitle">A32 ei soorita ühtegi komponenti neist: sooritab 2 komponenti neist: suudab seista ühel jalal lühiajaliselt abita, seisab ja käib varvastel ja kandadel, käib mööda joonistatud joont, hüppab koos jalgadega trepi valumiselt astmelt (parem, vasak eraldi)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'A32'"/>
				</xsl:call-template>
			</tr>
			<!-- Üldmotoorika lõpp-->
			<!-- Lihastoonus algus-->
			<tr>
				<th>Lihastoonus</th>
			</tr>
			<!-- C01-->
			<tr>
				<td class="rowTitle">C01 sümmeetriline toonus, patoloogiata, normis</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C01'"/>
				</xsl:call-template>
			</tr>
			<!-- C02-->
			<tr>
				<td class="rowTitle">C02 tendents hüpotoonuseks, mis ei mõju asendile või liigutusele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C02'"/>
				</xsl:call-template>
			</tr>
			<!-- C03-->
			<tr>
				<td class="rowTitle">C03 tendents hüpertoonuseks, mis ei mõju asendile või liigutusele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C03'"/>
				</xsl:call-template>
			</tr>
			<!-- C04-->
			<tr>
				<td class="rowTitle">C04 püsiv hüpotoonus, mis piirab spontaanseid liigutusi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C04'"/>
				</xsl:call-template>
			</tr>
			<!-- C05-->
			<tr>
				<td class="rowTitle">C05 püsiv hüpertoonus, mis piirab spontaanseid liigutusi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C05'"/>
				</xsl:call-template>
			</tr>
			<!-- C06-->
			<tr>
				<td class="rowTitle">C06 püsiv asümmeetria, mis piirab spontaanseid liigutusi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C06'"/>
				</xsl:call-template>
			</tr>
			<!-- C07-->
			<tr>
				<td class="rowTitle">C07 aktiivsed liigutused olemas, passiivsetel liigutustel lihastoonus normis</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C07'"/>
				</xsl:call-template>
			</tr>
			<!--C08 -->
			<tr>
				<td class="rowTitle">C08 lihastoonuse kerge/vähene muutus ja/või asümmeetriline toonus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C08'"/>
				</xsl:call-template>
			</tr>
			<!-- C09-->
			<tr>
				<td class="rowTitle">C09 lihastoonuse väljendunud/tugev muutus</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'C09'"/>
				</xsl:call-template>
			</tr>
			<!-- Lihastoonus lõpp-->
			<!-- Käte funktsioon/Käeline tegevus-->
			<tr>
				<th>Käte funktsioon/Käeline tegevus</th>
			</tr>
			<!-- B01-->
			<tr>
				<td class="rowTitle">B01 Käte viimine keskjoonele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B01'"/>
				</xsl:call-template>
			</tr>
			<!-- B02-->
			<tr>
				<td class="rowTitle">B02 Viib ühe käe keskjoonele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B02'"/>
				</xsl:call-template>
			</tr>
			<!-- B03-->
			<tr>
				<td class="rowTitle">B03 Ei vii käsi keskjoonele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B03'"/>
				</xsl:call-template>
			</tr>
			<!-- B04-->
			<tr>
				<td class="rowTitle">B04 Haarab mänguasju igast suunast, paneb need ühest käest teisse</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B04'"/>
				</xsl:call-template>
			</tr>
			<!-- B05-->
			<tr>
				<td class="rowTitle">B05 Haarab mänguasju, mis on asetatud tema ette</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B05'"/>
				</xsl:call-template>
			</tr>
			<!-- B06-->
			<tr>
				<td class="rowTitle">B06 Ei haara/võta mänguasju</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B06'"/>
				</xsl:call-template>
			</tr>
			<!-- B07-->
			<tr>
				<td class="rowTitle">B07 Võtab väikesi asju kahe sõrmega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B07'"/>
				</xsl:call-template>
			</tr>
			<!--B08 -->
			<tr>
				<td class="rowTitle">B08 Võtab mänguasju terve käega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B08'"/>
				</xsl:call-template>
			</tr>
			<!-- B09-->
			<tr>
				<td class="rowTitle">B09 Asetab ühe asja teise sisse, avab karpi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B09'"/>
				</xsl:call-template>
			</tr>
			<!-- B10-->
			<tr>
				<td class="rowTitle">B10 Ei mängi asjadega sihipäraselt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B10'"/>
				</xsl:call-template>
			</tr>
			<!-- B11-->
			<tr>
				<td class="rowTitle">B11 Käeline tegevus väga kohmakas või puudub</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B11'"/>
				</xsl:call-template>
			</tr>
			<!-- B12-->
			<tr>
				<td class="rowTitle">B12 Ehitab torni vähemalt kolmest klotsist ja pöörab raamatulehti 2-3 kaupa</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B12'"/>
				</xsl:call-template>
			</tr>
			<!-- B13-->
			<tr>
				<td class="rowTitle">B13 Paneb klotse üksteise peale korrapäraselt (puudub planeeritav tegevus)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B13'"/>
				</xsl:call-template>
			</tr>
			<!-- B14-->
			<tr>
				<td class="rowTitle">B14 Võtab klotse kätte, kuid ei mängi sihipäraselt või ei võta mänguasju</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B14'"/>
				</xsl:call-template>
			</tr>
			<!-- B15-->
			<tr>
				<td class="rowTitle">B15 Viskab palli kahe käe ja kogu kehaga, tõukab palli jalaga ja jääb püsti (mõlema jalaga)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B15'"/>
				</xsl:call-template>
			</tr>
			<!--B16 -->
			<tr>
				<td class="rowTitle">B16 Sooritab ühe tegevuse neist: viskab palli kahe käe ja kogu kehaga, tõukab palli jalaga ja jääb püsti (mõlema jalaga)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B16'"/>
				</xsl:call-template>
			</tr>
			<!-- B17-->
			<tr>
				<td class="rowTitle">B17 Ei soorita neid tegevusi: viskab palli kahe käe ja kogu kehaga, tõukab palli jalaga ja jääb püsti (mõlema jalaga)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B17'"/>
				</xsl:call-template>
			</tr>
			<!-- B18-->
			<tr>
				<td class="rowTitle">B18 Pöörab ramatulehti üksikult</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B18'"/>
				</xsl:call-template>
			</tr>
			<!--B19-->
			<tr>
				<td class="rowTitle">B19 Pöörab ramatulehti mitmekaupa</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B19'"/>
				</xsl:call-template>
			</tr>
			<!-- B20-->
			<tr>
				<td class="rowTitle">B20 Ei pööra raamatulehti</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B20'"/>
				</xsl:call-template>
			</tr>
			<!-- B21-->
			<tr>
				<td class="rowTitle">B21 Paneb üksteise otsa kuni 9 klotsi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B21'"/>
				</xsl:call-template>
			</tr>
			<!-- B22-->
			<tr>
				<td class="rowTitle">B22 Paneb üksteis otsa 2 klotsi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B22'"/>
				</xsl:call-template>
			</tr>
			<!-- B23-->
			<tr>
				<td class="rowTitle">B23 Ei pane üksteise otsa ühtegi klotsi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B23'"/>
				</xsl:call-template>
			</tr>
			<!--B24 -->
			<tr>
				<td class="rowTitle">B24 Lõikab kääridega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B24'"/>
				</xsl:call-template>
			</tr>
			<!-- B25-->
			<tr>
				<td class="rowTitle">B25 Lõikab kääridega vaevaliselt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B25'"/>
				</xsl:call-template>
			</tr>
			<!--B26-->
			<tr>
				<td class="rowTitle">B26 Ei lõika kääridega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'B26'"/>
				</xsl:call-template>
			</tr>
			<!-- Kongenitaalsed refleksid-->
			<tr>
				<th>Kongenitaalsed refleksid</th>
			</tr>
			<!-- D01-->
			<tr>
				<td class="rowTitle">D01 Refleksid vallanduvad sümmeetriliselt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D01'"/>
				</xsl:call-template>
			</tr>
			<!-- D02-->
			<tr>
				<td class="rowTitle">D02 Refleksid nõuavad vallandumiseks pikemaajalist stimulatsiooni</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D02'"/>
				</xsl:call-template>
			</tr>
			<!-- D03-->
			<tr>
				<td class="rowTitle">D03 Refleksid puuduvad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D03'"/>
				</xsl:call-template>
			</tr>
			<!-- D04-->
			<tr>
				<td class="rowTitle">D04 Tendents kõikide reflekside kustumisele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D04'"/>
				</xsl:call-template>
			</tr>
			<!-- D05-->
			<tr>
				<td class="rowTitle">D05 Puudub tendents kõikide reflekside kustumisele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D05'"/>
				</xsl:call-template>
			</tr>
			<!-- D06-->
			<tr>
				<td class="rowTitle">D06 Refleksid elavnevad või puuduvad va oraalse automatismi refleksid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D06'"/>
				</xsl:call-template>
			</tr>
			<!-- D07-->
			<tr>
				<td class="rowTitle">BD07 Refleksid kustunud va imemine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D07'"/>
				</xsl:call-template>
			</tr>
			<!--D08 -->
			<tr>
				<td class="rowTitle">D08 Nõrgalt väljendunud mõned Moro refleksi elemendid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D08'"/>
				</xsl:call-template>
			</tr>
			<!-- D09-->
			<tr>
				<td class="rowTitle">D09 Esineb mõni refleks(id)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'D09'"/>
				</xsl:call-template>
			</tr>
			<!-- Kongenitaalsed refleksid lõpp-->
			<!-- Söömisoskused ja Toitumisharjumused algus-->
			<tr>
				<th>Söömisoskused ja Toitumisharjumused</th>
			</tr>
			<!-- G01-->
			<tr>
				<td class="rowTitle">G01 imeb jõudsalt, neelamine vaba</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G01'"/>
				</xsl:call-template>
			</tr>
			<!-- G02-->
			<tr>
				<td class="rowTitle">G02 imeb ahmides, väsib kiiresti, läkastab palju</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G02'"/>
				</xsl:call-template>
			</tr>
			<!-- G03-->
			<tr>
				<td class="rowTitle">G03 ei ime</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G03'"/>
				</xsl:call-template>
			</tr>
			<!-- G04-->
			<tr>
				<td class="rowTitle">G04 suudab lusikalt toitu võtta, neelamine vaba</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G04'"/>
				</xsl:call-template>
			</tr>
			<!-- G05-->
			<tr>
				<td class="rowTitle">G05 sööb lutipudelist</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G05'"/>
				</xsl:call-template>
			</tr>
			<!-- G06-->
			<tr>
				<td class="rowTitle">G06 imeb loitult, kipub läkastama</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G06'"/>
				</xsl:call-template>
			</tr>
			<!-- G07-->
			<tr>
				<td class="rowTitle">G07 on tekkinud närimisliigutused, suudab neelata tahket toitu</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G07'"/>
				</xsl:call-template>
			</tr>
			<!--G08 -->
			<tr>
				<td class="rowTitle">G08 sööb lusikast, kuid närimisliigutusi veel ei ole</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G08'"/>
				</xsl:call-template>
			</tr>
			<!-- G09-->
			<tr>
				<td class="rowTitle">G09 sööb tahket toitu, joob kruusist</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G09'"/>
				</xsl:call-template>
			</tr>
			<!-- G10-->
			<tr>
				<td class="rowTitle">G10 sööb lusikast peenestatud toitu</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G10'"/>
				</xsl:call-template>
			</tr>
			<!-- G11-->
			<tr>
				<td class="rowTitle">G11 sööb ise lusikast</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G11'"/>
				</xsl:call-template>
			</tr>
			<!-- G12-->
			<tr>
				<td class="rowTitle">G12 sööb lusikast, kuid määrib ennast</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G12'"/>
				</xsl:call-template>
			</tr>
			<!-- G13-->
			<tr>
				<td class="rowTitle">G13 ei söö lusikast</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G13'"/>
				</xsl:call-template>
			</tr>
			<!-- G14-->
			<tr>
				<td class="rowTitle">G14 sööb kahvli ja noaga</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G14'"/>
				</xsl:call-template>
			</tr>
			<!-- G15-->
			<tr>
				<td class="rowTitle">G15 sööb lusikaga</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G15'"/>
				</xsl:call-template>
			</tr>
			<!--G16 -->
			<tr>
				<td class="rowTitle">G16 ei söö iseseisvalt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'G16'"/>
				</xsl:call-template>
			</tr>
			<!-- Potirežiim-->
			<tr>
				<th>Potirežiim</th>
			</tr>
			<!-- L01-->
			<tr>
				<td class="rowTitle">L01 enamasti kuiv, käib potil</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L01'"/>
				</xsl:call-template>
			</tr>
			<!-- L02-->
			<tr>
				<td class="rowTitle">L02 vahetevahel õnnestub potitada</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L02'"/>
				</xsl:call-template>
			</tr>
			<!-- L03-->
			<tr>
				<td class="rowTitle">L03 põhiliselt märg</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L03'"/>
				</xsl:call-template>
			</tr>
			<!-- L04-->
			<tr>
				<td class="rowTitle">L04 päeval ja öösel kuiv, oskab anda märku oma vajadustest</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L04'"/>
				</xsl:call-template>
			</tr>
			<!-- L05-->
			<tr>
				<td class="rowTitle">L05 öösel märg, päeval kuiv</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L05'"/>
				</xsl:call-template>
			</tr>
			<!-- L06-->
			<tr>
				<td class="rowTitle">L06 sageli märg ka päeval, ei oska väljendada oma soovi</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L06'"/>
				</xsl:call-template>
			</tr>
			<!-- L07-->
			<tr>
				<td class="rowTitle">L07 käib iseseisvalt potil</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L07'"/>
				</xsl:call-template>
			</tr>
			<!--L08 -->
			<tr>
				<td class="rowTitle">L08 ei käi potil</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'L08'"/>
				</xsl:call-template>
			</tr>
			<!-- Potirežiim lõpp-->
			<!-- Artikulatsiooniharjumused/Verbaalne kõne-->
			<tr>
				<th>Artikulatsiooniharjumused/Verbaalne kõne</th>
			</tr>
			<!-- I01-->
			<tr>
				<td class="rowTitle">I01 koogab, kisab</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I01'"/>
				</xsl:call-template>
			</tr>
			<!-- I02-->
			<tr>
				<td class="rowTitle">I02 ei kooga, kisa jõuline</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I02'"/>
				</xsl:call-template>
			</tr>
			<!-- I03-->
			<tr>
				<td class="rowTitle">I03 kisa nõrk, vigisev</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I03'"/>
				</xsl:call-template>
			</tr>
			<!-- I04-->
			<tr>
				<td class="rowTitle">I04 lalin täishäälikutest</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I04'"/>
				</xsl:call-template>
			</tr>
			<!-- I05-->
			<tr>
				<td class="rowTitle">I05 koogab</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I05'"/>
				</xsl:call-template>
			</tr>
			<!-- I06-->
			<tr>
				<td class="rowTitle">I06 kisab</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I06'"/>
				</xsl:call-template>
			</tr>
			<!-- I07-->
			<tr>
				<td class="rowTitle">I07 laliseb palju</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I07'"/>
				</xsl:call-template>
			</tr>
			<!--I08 -->
			<tr>
				<td class="rowTitle">I08 laliseb vähe</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I08'"/>
				</xsl:call-template>
			</tr>
			<!-- I09-->
			<tr>
				<td class="rowTitle">I09 lalin puudub</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I09'"/>
				</xsl:call-template>
			</tr>
			<!-- I10-->
			<tr>
				<td class="rowTitle">I10 kasutab üksikuid tähendusega silp</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I10'"/>
				</xsl:call-template>
			</tr>
			<!-- I11-->
			<tr>
				<td class="rowTitle">I11 sõnaline kõne</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I11'"/>
				</xsl:call-template>
			</tr>
			<!-- I12-->
			<tr>
				<td class="rowTitle">I12 kasutab fraasi (kahesõnaväljend)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I12'"/>
				</xsl:call-template>
			</tr>
			<!-- I13-->
			<tr>
				<td class="rowTitle">I13 kasutab ühesõnaväljendid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I13'"/>
				</xsl:call-template>
			</tr>
			<!-- I14-->
			<tr>
				<td class="rowTitle">I14 kasutab fraasi 2- või 3-sõnalisi väljendeid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I14'"/>
				</xsl:call-template>
			</tr>
			<!-- I15-->
			<tr>
				<td class="rowTitle">I15 kasutab ühesõnaväljendit</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I15'"/>
				</xsl:call-template>
			</tr>
			<!--I16 -->
			<tr>
				<td class="rowTitle">I16 sõnad puuduvad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I16'"/>
				</xsl:call-template>
			</tr>
			<!-- I17-->
			<tr>
				<td class="rowTitle">I17 kasutab grammatiliselt õiget lauset, üksikud häälikuvead on lubatud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I17'"/>
				</xsl:call-template>
			</tr>
			<!-- I18-->
			<tr>
				<td class="rowTitle">I18 kasutab lihtlauset</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I18'"/>
				</xsl:call-template>
			</tr>
			<!--I19-->
			<tr>
				<td class="rowTitle">I19 kasutab üksikud sõnad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I19'"/>
				</xsl:call-template>
			</tr>
			<!-- I20-->
			<tr>
				<td class="rowTitle">I20 ehholaalia kõnes kadunud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I20'"/>
				</xsl:call-template>
			</tr>
			<!-- I21-->
			<tr>
				<td class="rowTitle">I21 esineb ehholaaliat</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'I21'"/>
				</xsl:call-template>
			</tr>
			<!-- Artikulatsiooniharjumused/Verbaalne kõne lõpp-->
			<!-- Kommunikatiivsus algus-->
			<tr>
				<th>Kommunikatiivsus</th>
			</tr>
			<!--J01-->
			<tr>
				<td class="rowTitle">J01 fikseerib pilgu, silmside, pilgukontakt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J01'"/>
				</xsl:call-template>
			</tr>
			<!-- J02-->
			<tr>
				<td class="rowTitle">J02 fikseerib pilgu lühiajaliselt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J02'"/>
				</xsl:call-template>
			</tr>
			<!-- J03-->
			<tr>
				<td class="rowTitle">J03 ei fikseeri pilku</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J03'"/>
				</xsl:call-template>
			</tr>
			<!-- J04-->
			<tr>
				<td class="rowTitle">J04 naeratab kõnetamisel, jälgib</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J04'"/>
				</xsl:call-template>
			</tr>
			<!-- J05-->
			<tr>
				<td class="rowTitle">J05 näitab suhtluses välja rõõmu ja pahameelt, tekivad esimesed matkimisharjutused</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J05'"/>
				</xsl:call-template>
			</tr>
			<!-- J06-->
			<tr>
				<td class="rowTitle">J06 pilgukontakt koos adresseeritud naeratusega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J06'"/>
				</xsl:call-template>
			</tr>
			<!-- J07-->
			<tr>
				<td class="rowTitle">J07 tekivad esimesed žestid (käte sirutamine sülletahtmisel)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J07'"/>
				</xsl:call-template>
			</tr>
			<!--J08 -->
			<tr>
				<td class="rowTitle">J08 naeratab kõnetamisel, näitab suhtluses välja rõõmu ja pahameelt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J08'"/>
				</xsl:call-template>
			</tr>
			<!-- J09-->
			<tr>
				<td class="rowTitle">J09 kasutab sõnu</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J09'"/>
				</xsl:call-template>
			</tr>
			<!-- J10-->
			<tr>
				<td class="rowTitle">J10 kasutab žeste ja osutamist</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'J10'"/>
				</xsl:call-template>
			</tr>
			<!-- Kommunikatiivsus lõpp-->
			<!-- Kõne taju (sensoorne kuulmine) algus-->
			<tr>
				<th>Kõne taju (sensoorne kuulmine)</th>
			</tr>
			<!-- K01-->
			<tr>
				<td class="rowTitle">K01 reageerib helidele mõlemapoolselt</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K01'"/>
				</xsl:call-template>
			</tr>
			<!-- K02-->
			<tr>
				<td class="rowTitle">K02 reageerib väga tugevatele helidele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K02'"/>
				</xsl:call-template>
			</tr>
			<!-- K03-->
			<tr>
				<td class="rowTitle">K03 ei reageeri helidele ega kõnele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K03'"/>
				</xsl:call-template>
			</tr>
			<!-- K04-->
			<tr>
				<td class="rowTitle">K04 kuuleb kõnet (pöörab pead hääle suunas)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K04'"/>
				</xsl:call-template>
			</tr>
			<!-- K05-->
			<tr>
				<td class="rowTitle">K05 reageerib olmehelidele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K05'"/>
				</xsl:call-template>
			</tr>
			<!-- K06-->
			<tr>
				<td class="rowTitle">K06 reageerib oma nimele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K06'"/>
				</xsl:call-template>
			</tr>
			<!-- K07-->
			<tr>
				<td class="rowTitle">K07 vastab kõnetamisele lalinaga, nimele ei reageeri</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K07'"/>
				</xsl:call-template>
			</tr>
			<!--K08 -->
			<tr>
				<td class="rowTitle">K08 ei reageeri kõnele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K08'"/>
				</xsl:call-template>
			</tr>
			<!-- K09-->
			<tr>
				<td class="rowTitle">K09 rtekivad esimesed seosed sõna ja eseme vahel</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K09'"/>
				</xsl:call-template>
			</tr>
			<!-- K10-->
			<tr>
				<td class="rowTitle">K10 reageerib oma nimele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K10'"/>
				</xsl:call-template>
			</tr>
			<!-- K11-->
			<tr>
				<td class="rowTitle">K11 reageerib kõnele</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K11'"/>
				</xsl:call-template>
			</tr>
			<!-- K12-->
			<tr>
				<td class="rowTitle">K12 hulgaliselt mõisteid ( ~10~12) (aken, lill, ema, tuli jne)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K12'"/>
				</xsl:call-template>
			</tr>
			<!-- K13-->
			<tr>
				<td class="rowTitle">K13 üksikud mõisted</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K13'"/>
				</xsl:call-template>
			</tr>
			<!-- K14-->
			<tr>
				<td class="rowTitle">K14 kuuleb kõnet, reageerib sellele häälitsusega</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'K14'"/>
				</xsl:call-template>
			</tr>
			<!-- Kõne taju (sensoorne kuulmine) lõpp-->
			<!-- Kraniaalnärvid (III, IV,VI silmaliigutajad ja VII näo miimika) algus-->
			<tr>
				<th>Kraniaalnärvid (III, IV,VI silmaliigutajad ja VII näo miimika)</th>
			</tr>
			<!-- E01-->
			<tr>
				<td class="rowTitle">E01 Patoloogiata</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'E01'"/>
				</xsl:call-template>
			</tr>
			<!-- E02-->
			<tr>
				<td class="rowTitle">E02 Mittepüsiv/kerge konvergeeruv strabism(kõõritus) ja/või näo kerge asümmeetria</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'E02'"/>
				</xsl:call-template>
			</tr>
			<!-- E03-->
			<tr>
				<td class="rowTitle">E03 Püsiv kraniaalnärvi(de) patoloogia</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'E03'"/>
				</xsl:call-template>
			</tr>
			<!-- Kraniaalnärvid (III, IV,VI silmaliigutajad ja VII näo miimika) lõpp-->
			<!-- Kõõlusperiostaalrefleksid algus-->
			<tr>
				<th>Kõõlusperiostaalrefleksid</th>
			</tr>
			<!-- M01-->
			<tr>
				<td class="rowTitle">M01 külgühtlased või normaalsed või patoloogiata</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M01'"/>
				</xsl:call-template>
			</tr>
			<!-- M02-->
			<tr>
				<td class="rowTitle">M02 elavnenud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M02'"/>
				</xsl:call-template>
			</tr>
			<!-- M03-->
			<tr>
				<td class="rowTitle">M03 madalad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M03'"/>
				</xsl:call-template>
			</tr>
			<!-- M04-->
			<tr>
				<td class="rowTitle">M04 asümmeetrilised</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M04'"/>
				</xsl:call-template>
			</tr>
			<!-- M05-->
			<tr>
				<td class="rowTitle">M05 tugevalt elavnenud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M05'"/>
				</xsl:call-template>
			</tr>
			<!-- M06-->
			<tr>
				<td class="rowTitle">M06 puuduvad</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M06'"/>
				</xsl:call-template>
			</tr>
			<!-- M07-->
			<tr>
				<td class="rowTitle">M07 tugev asümmeetria</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M07'"/>
				</xsl:call-template>
			</tr>
			<!--M08 -->
			<tr>
				<td class="rowTitle">M08 mööduv muutus (↑ või ↓)</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'M08'"/>
				</xsl:call-template>
			</tr>
			<!-- Kõõlusperiostaalrefleksid lõpp-->
			<!-- Stigmad (mikroanomaaliad) algus-->
			<tr>
				<th>Stigmad (mikroanomaaliad)</th>
			</tr>
			<!-- H01-->
			<tr>
				<td class="rowTitle">H01 stigmasid ei ole</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'H01'"/>
				</xsl:call-template>
			</tr>
			<!-- H02-->
			<tr>
				<td class="rowTitle">H02 stigmasid on alla 3</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'H02'"/>
				</xsl:call-template>
			</tr>
			<!-- H03-->
			<tr>
				<td class="rowTitle">H03 stigmasid on üle  3</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'H03'"/>
				</xsl:call-template>
			</tr>
			<!-- Stigmad (mikroanomaaliad)  lõpp-->
			<!-- Krambid algus-->
			<tr>
				<th>Krambid</th>
			</tr>
			<!-- F01-->
			<tr>
				<td class="rowTitle">F01 ei ole krampe</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'F01'"/>
				</xsl:call-template>
			</tr>
			<!-- F02-->
			<tr>
				<td class="rowTitle">F02 on krambid</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'F02'"/>
				</xsl:call-template>
			</tr>
			<!-- F03-->
			<tr>
				<td class="rowTitle">F03 on krambid, raviga kontrollitud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'F03'"/>
				</xsl:call-template>
			</tr>
			<!-- F04-->
			<tr>
				<td class="rowTitle">F04 on krambid, raviga halvasti kontrollitud</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'F04'"/>
				</xsl:call-template>
			</tr>
			<!-- Krambid lõpp-->
			<!-- Arengu hindamine algus-->
			<tr>
				<th>Arengu hindamine</th>
			</tr>
			<xsl:for-each select="urn:entry[substring(urn:observation/urn:code/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.37']">
				<tr>
					<td class="rowTitle">
						<xsl:value-of select="urn:observation/urn:code/@displayName"/>
					</td>
					<xsl:call-template name="codeData">
						<xsl:with-param name="healthcontrolType" select="urn:observation/urn:code/@code"/>
					</xsl:call-template>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--
	Template for processAll
Tervisekaardil: Läbivaatus vanusegruppidena
	-->
	<xsl:template name="section.processAll" match="urn:section" mode="processAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="24">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="childProgress"/>
			</tr>
			<!-- 122561005-->
			<tr>
				<td class="rowTitle">Kliinilise vere analüüs</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'122561005'"/>
				</xsl:call-template>
			</tr>
			<!--VISACUITY-->
			<tr>
				<td class="rowTitle">Nägemisteravuse kontroll</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'VISACUITY'"/>
				</xsl:call-template>
			</tr>
			<!-- Z01.3-->
			<tr>
				<td class="rowTitle">Arteriaalse vererõhu mõõtmine</td>
				<xsl:call-template name="observationData">
					<xsl:with-param name="healthcontrolType" select="'Z01.3'"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--
Template for process
	-->
	<xsl:template name="section.process" match="urn:section" mode="process">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Uuringu liik</th>
				<th>Vanusegrupp</th>
				<th>Toimumise kuupäev</th>
				<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode">
					<th>Uuringu koht</th>
				</xsl:if>
				<th>Tulemus</th>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
						<tr class="rowValue">
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
							<td class="dataTableCell">
								<xsl:value-of select="urn:targetSiteCode/@displayName"/>
							</td>
							<td class="dataTableCell">
								<xsl:choose>
									<xsl:when test="urn:reference/urn:externalDocument">
										<xsl:for-each select="urn:reference/urn:externalDocument">
											<xsl:value-of select="urn:code/@displayName"/>
											<xsl:text> nr </xsl:text>
											<xsl:value-of select="urn:id/@extension"/>
											<xsl:text> versioon </xsl:text>
											<xsl:value-of select="urn:versionNumber/@value"/>
										</xsl:for-each>
									</xsl:when>
									<xsl:otherwise>
										<xsl:choose>
											<xsl:when test="urn:entryRelationship">
												<xsl:for-each select="urn:entryRelationship/urn:observation">
													<xsl:value-of select="urn:code/@displayName"/>
													<xsl:text> </xsl:text>
													<xsl:value-of select="urn:value/@value"/>
													<xsl:text> </xsl:text>
													<xsl:value-of select="urn:value/@unit"/>
												</xsl:for-each>
											</xsl:when>
											<xsl:otherwise>
												<xsl:choose>
													<xsl:when test="substring(urn:value/@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.55'">
														<xsl:value-of select="urn:value/@code"/>
														<xsl:text> - </xsl:text>
														<xsl:value-of select="urn:value/@displayName"/>
														<br/>
														<xsl:value-of select="urn:value/urn:originalText"/>
														<br/>
														<xsl:text>RHK10: </xsl:text>
														<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@code"/>
														<xsl:text> - </xsl:text>
														<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@displayName"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="urn:value/@value"/>
														<xsl:text> </xsl:text>
														<xsl:value-of select="urn:value/@unit"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:otherwise>
								</xsl:choose>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for mantouxAll
Tervisekaardil: Tuberkuliin/Mantoux testi tulemused vanusegruppidena
	-->
	<xsl:template name="section.mantouxAll" match="urn:section" mode="mantouxAll">
		<table>
			<tr>
				<td class="blockLabel" colspan="16">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<xsl:call-template name="immunizationProgress"/>
			</tr>
			<!-- VXX-->
			<tr>
				<td class="rowTitle">Tuberkuliin/Mantoux test</td>
				<xsl:call-template name="immunizationData">
					<xsl:with-param name="healthcontrolType" select="urn:entry/urn:observation/urn:code/@code"/>
				</xsl:call-template>
			</tr>
		</table>
	</xsl:template>
	<!--

	Template for mantoux
	-->
	<xsl:template name="section.mantoux" match="urn:section" mode="mantoux">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
				<tr>
					<td class="rowTitle">Vanusegrupp</td>
					<td colspan="2" class="rowValue">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">Kuupäev</td>
					<td class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">Tulemus</td>
					<td class="rowValue">
						<xsl:value-of select="urn:code/@displayName"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!-- template observationData

-->
	<xsl:template name="observationData">
		<xsl:param name="healthcontrolType"/>
		<!-- 1 päev-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1P'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 nädal-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 nädalat -->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 kuu-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 4,5 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='4,5K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 6 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='6K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 5 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='5A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 7 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='7A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--8 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='8A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 10 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='10A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--14 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='14A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 16 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='16A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
	</xsl:template>
	<!-- template codeData

-->
	<xsl:template name="codeData">
		<xsl:param name="healthcontrolType"/>
		<!-- 1 päev-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1P'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 nädal-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 nädalat -->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 kuu-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 4,5 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='4,5K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 6 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='6K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 5 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='5A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 7 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='7A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--8 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='8A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 10 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='10A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--14 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='14A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 16 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='16A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
	</xsl:template>
	<!-- template actData

-->
	<xsl:template name="actData">
		<xsl:param name="healthcontrolType"/>
		<!-- 1 päev-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1P'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 nädal-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 nädalat -->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2N'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 kuu-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='1K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 4,5 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='4,5K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 6 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='6K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='2A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='3A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 5 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='5A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 7 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='7A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--8 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='8A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 9 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='9A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 10 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='10A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='12A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--14 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='14A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 16 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='16A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 18 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:act[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'pnka','PNKA')='18A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
	</xsl:template>
	<!-- template observationData2

-->
	<xsl:template name="observationData2">
		<xsl:param name="healthcontrolType"/>
		<!-- Pikkus, Kaal ja peaümbermõõt-->
		<xsl:if test="$healthcontrolType='LENGTH' or $healthcontrolType='WEIGTH' or $healthcontrolType='HPM' or $healthcontrolType='364589006' or $healthcontrolType='363809009' or $healthcontrolType='50373000'">
			<xsl:value-of select="urn:value/@value"/>
		</xsl:if>
		<!-- Lõge-->
		<xsl:if test="$healthcontrolType='BLFONTANEL'">
			<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='LFONTANEL']/urn:value/@value"/>
			<xsl:text> x </xsl:text>
			<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='BFONTANEL']/urn:value/@value"/>
		</xsl:if>
		<!-- KMI-->
		<xsl:if test="$healthcontrolType='KMI' or $healthcontrolType='60621009'">
			<xsl:value-of select="round((urn:value/urn:numerator/@value) div (urn:value/urn:denominator/@value))"/>
		</xsl:if>
		<!-- Arengu hindamine-->
		<xsl:if test="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.60'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.74'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.53']
		or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.50'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.47'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.68']
		or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.62'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.39'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.46']
		or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.51'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.49'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.52']
		or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.67'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.48'] ">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:value-of select="urn:code/urn:originalText"/>
			<br/>
			<!--<xsl:if test="urn:author">
				<xsl:call-template name="timeCriticalSourceAuthor">
					<xsl:with-param name="tabel" select="'Ei'"/>
				</xsl:call-template>
				<br/>
			</xsl:if>-->
		</xsl:if>
		<!-- Areng-->
		<xsl:if test="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.37']">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:call-template name="negation"/>
			<br/>
			<xsl:value-of select="urn:code/urn:originalText"/>
		</xsl:if>
		<!-- Pere olukord-->
		<xsl:if test="urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.77'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.69'] or 
		urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.63'] or urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.73']">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:value-of select="urn:value"/>
			<br/>
		</xsl:if>
		<!--Mantoux test-->
		<xsl:if test="$healthcontrolType='268376005' or $healthcontrolType='268375009'">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:value-of select="urn:code/@displayName"/>
			<br/>
		</xsl:if>
		<!-- Läbivaatuse andmed-->
		<xsl:if test="(urn:code[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.2.26'] and $healthcontrolType!='LENGTH' 
		and $healthcontrolType!='WEIGTH' and $healthcontrolType!='HPM' and $healthcontrolType!='BLFONTANEL'
		and $healthcontrolType!='KMI' and $healthcontrolType!='CLBLOOD' and $healthcontrolType!='VISACUITY') or $healthcontrolType='364307006' or $healthcontrolType='248957007' or 
		$healthcontrolType='364310004' or $healthcontrolType='161720007'">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<table>
				<xsl:for-each select="urn:value">
					<tr>
						<td>
							<xsl:value-of select="@displayName"/>
							<br/>
							<xsl:value-of select="urn:originalText"/>
							<xsl:if test="@value">
								<xsl:value-of select="@value"/>
							</xsl:if>
							<xsl:if test="urn:low or urn:high">
								<xsl:value-of select="urn:low/@value"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:high/@value"/>
							</xsl:if>
						</td>
					</tr>
				</xsl:for-each>
			</table>
			<xsl:text>RHK10: </xsl:text>
			<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@code"/>
			<xsl:text> - </xsl:text>
			<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@displayName"/>
			<br/>
		</xsl:if>
		<!--kliiniline vereanalüüs-->
		<xsl:if test="$healthcontrolType='122561005'">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:value-of select="urn:value/@code"/>
			<xsl:text> - </xsl:text>
			<xsl:value-of select="urn:value/@displayName"/>
			<br/>
			<xsl:value-of select="urn:value/urn:originalText"/>
			<br/>
			<xsl:text>RHK10: </xsl:text>
			<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@code"/>
			<xsl:text> - </xsl:text>
			<xsl:value-of select="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.13']/@displayName"/>
		</xsl:if>
		<!--nägemisteravuse kontroll-->
		<xsl:if test="$healthcontrolType='VISACUITY'">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<br/>
			<xsl:value-of select="urn:targetSiteCode/@displayName"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="urn:value/@value"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="urn:value/@unit"/>
			<br/>
		</xsl:if>
		<!--Vererõhk: süstoolne ja diastoolne-->
		<xsl:if test="$healthcontrolType='Z01.3'">
			<xsl:call-template name="dateFormat">
				<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
			</xsl:call-template>
			<xsl:text>  </xsl:text>
			<xsl:value-of select="urn:targetSiteCode/@displayName"/>
			<br/>
			<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='271649006'">
				<xsl:text>Süstoolne: </xsl:text>
				<xsl:call-template name="dateFormat">
					<xsl:with-param name="date" select="urn:entryRelationship/urn:observation[urn:code/@code='271649006']/urn:effectiveTime/@value"/>
				</xsl:call-template>
				<xsl:text>  </xsl:text>
				<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271649006']/urn:value/@value"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271649006']/urn:value/@unit"/>
				<br/>
			</xsl:if>
			<xsl:if test="urn:entryRelationship/urn:observation/urn:code/@code='271650006'">
				<xsl:text>Diastoolne: </xsl:text>
				<xsl:text>  </xsl:text>
				<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271650006']/urn:value/@value"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271650006']/urn:value/@unit"/>
			</xsl:if>
			<br/>
		</xsl:if>
	</xsl:template>
	<!-- template childProgressColumns
-->
	<xsl:template name="childProgress">
		<th> </th>
		<th>1 p</th>
		<th>1 n</th>
		<th>2 n</th>
		<th>1 k</th>
		<th>2 k</th>
		<th>3 k</th>
		<th>4,5 k</th>
		<th>6 k</th>
		<th>9 k</th>
		<th>12 k</th>
		<th>18 k</th>
		<th>2 a</th>
		<th>3 a</th>
		<th>5 a</th>
		<th>7 a</th>
		<th>8 a</th>
		<th>9 a</th>
		<th>10 a</th>
		<th>12 a</th>
		<th>14 a</th>
		<th>16 a</th>
		<th>18 a</th>
	</xsl:template>
	<!-- template immunizationProgressColumns
-->
	<xsl:template name="immunizationProgress">
		<th> </th>
		<th>12H</th>
		<th>1-5P</th>
		<th>1K</th>
		<th>3K</th>
		<th>4,5K</th>
		<th>6K</th>
		<th>12K</th>
		<th>2A</th>
		<th>7A</th>
		<th>12A</th>
		<th>13A</th>
		<th>13A1K</th>
		<th>13A7K</th>
		<th>17A</th>
	</xsl:template>
	<!--
	Template for growth data
	-->
	<xsl:template name="section.growth" match="urn:section" mode="growth">
		<xsl:param name="ageGroup"/>
		<table>
			<tr>
				<td class="blockLabel" colspan="4">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<th>Kuupäev</th>
				<th>Vanusegrupp</th>
				<th>Mõõtmine</th>
				<th>Tulemus</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:observation[translate(urn:code/urn:qualifier/urn:value/@code,'hpnka','HPNKA')=$ageGroup or $ageGroup='All']">
				<tr>
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:code/@displayName"/>
					</td>
					<td class="dataTableCell">
						<xsl:call-template name="observationData2">
							<xsl:with-param name="healthcontrolType" select="urn:code/@code"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!-- Template for ageSection-->
	<xsl:template name="component.ageSection" match="urn:component" mode="AgeSection">
		<xsl:param name="age"/>
		<xsl:if test="urn:section[urn:code/@code='ANAM']/urn:entry/urn:encounter/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='ANAM']" mode="anamnesisAll">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='GROWTH']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='GROWTH']" mode="growth">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='PROC']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='PROC']" mode="process">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='PHYS']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='PHYS']" mode="phys">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='PROG']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='PROG']" mode="progress">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='GUID']/urn:entry/urn:act/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='GUID']" mode="guidance">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='FAMILY']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='FAMILY']" mode="guidanceGeneral">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='CUSTOM']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='CUSTOM']" mode="guidanceGeneral">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='PSYHSOC']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='PSYHSOC']" mode="guidanceGeneral">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='MENTAL']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='MENTAL']" mode="guidanceGeneral">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='MANTOUX']/urn:entry/urn:observation/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='MANTOUX']" mode="mantoux">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="urn:section[urn:code/@code='IMM']/urn:entry/urn:procedure/urn:code/urn:qualifier/urn:value[translate(@code,'hpnka','HPNKA')=$age]">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:section[urn:code/@code='IMM']" mode="immunization">
						<xsl:with-param name="ageGroup" select="$age"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--
	Template for lastCases info
	-->
	<xsl:template name="section.lastCases" match="urn:section" mode="lastCases">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td colspan="2">
							<span class="rowTitle">Haigusjuhtumi number</span>
							<xsl:text>  </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:encounter/urn:id/@extension"/>
							</span>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<span class="rowTitle">Haigusjuhtumi liik</span>
							<xsl:text>  </xsl:text>
							<span class="rowValue">
								<xsl:value-of select="urn:entry/urn:encounter/urn:code/@displayName"/>
							</span>
						</td>
					</tr>
					<xsl:if test="urn:entry/urn:encounter/urn:effectiveTime/urn:low or urn:entry/urn:encounter/urn:effectiveTime/urn:high">
						<tr>
							<td>
								<span class="rowTitle">Algus</span>
								<xsl:text> </xsl:text>
								<span class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/urn:low/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</span>
							</td>
							<td>
								<span class="rowTitle">Lõpp</span>
								<xsl:text> </xsl:text>
								<span class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/urn:high/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</span>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter/urn:effectiveTime/@value">
						<tr>
							<td colspan="2">
								<span class="rowTitle">Kuupäev</span>
								<xsl:text> </xsl:text>
								<span class="rowValue">
									<xsl:call-template name="dateFormat">
										<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/@value"/>
										<xsl:with-param name="format" select="'time'"/>
									</xsl:call-template>
								</span>
							</td>
						</tr>
					</xsl:if>
					<tr>
						<td colspan="2">
							<!-- template for diagnosis -->
							<xsl:call-template name="section.epicrisisDiagnosis"/>
						</td>
					</tr>
					<xsl:if test="urn:entry/urn:encounter/urn:author">
						<xsl:for-each select="urn:entry/urn:encounter">
							<tr>
								<td colspan="2">
									<!-- template for timeCriticalSource -->
									<xsl:call-template name="timeCriticalSourceAuthor">
										<xsl:with-param name="tabel" select="'Ei'"/>
									</xsl:call-template>
								</td>
							</tr>
						</xsl:for-each>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	Template for timeCriticalSourceAuthor info
	-->
	<xsl:template name="timeCriticalSourceAuthor" match="urn:observation" mode="autor">
		<xsl:param name="tabel"/>
		<xsl:param name="pealkiri"/>
		<table>
			<xsl:if test="$tabel='Ei'">
				<tr class="rowTitle">
					<th colspan="2">Allikas</th>
				</tr>
			</xsl:if>
			<tr>
				<td>
					<table>
						<xsl:for-each select="urn:author">
							<xsl:if test="urn:time">
								<tr>
									<td>
										<span class="rowTitle">Kuupäev</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:time/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:assignedAuthor/urn:id">
								<tr>
									<td>
										<span class="rowTitle">Tervishoiutöötaja kood</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:assignedAuthor/urn:id/@extension"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:assignedAuthor/urn:assignedPerson/urn:name">
								<tr>
									<td>
										<span class="rowTitle">Nimi</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:assignedAuthor/urn:assignedPerson/urn:name/urn:given"/>
											<xsl:text>  </xsl:text>
											<xsl:value-of select="urn:assignedAuthor/urn:assignedPerson/urn:name/urn:family"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:assignedAuthor/urn:representedOrganization">
								<tr>
									<td>
										<span class="rowTitle">TTO asutus</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:id/@extension"/>
											<xsl:text>  </xsl:text>
											<xsl:value-of select="urn:assignedAuthor/urn:representedOrganization/urn:name"/>
										</span>
									</td>
								</tr>
							</xsl:if>
						</xsl:for-each>
					</table>
				</td>
				<td>
					<table>
						<xsl:for-each select="urn:reference/urn:externalDocument">
							<xsl:if test="urn:id">
								<tr>
									<td>
										<span class="rowTitle">Dokumendi number</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:id/@extension"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:versionNumber">
								<tr>
									<td>
										<span class="rowTitle">Versioon</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:versionNumber/@value"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:code">
								<tr>
									<td>
										<span class="rowTitle">Dokumendi tüüp</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:code/@displayName"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="urn:text">
								<tr>
									<td>
										<span class="rowTitle">Kirjeldus</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="urn:text"/>
										</span>
									</td>
								</tr>
							</xsl:if>
						</xsl:for-each>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for EXTtimeCriticalSourceAuthor info
	-->
	<xsl:template name="EXTtimeCriticalSourceAuthor">
		<xsl:param name="tabel"/>
		<table>
			<xsl:if test="$tabel='Ei'">
				<tr class="rowTitle">
					<th colspan="2">Allikas</th>
				</tr>
			</xsl:if>
			<tr>
				<td>
					<table>
						<xsl:for-each select="ext:author">
							<xsl:if test="ext:time">
								<tr>
									<td>
										<span class="rowTitle">Kuupäev</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="ext:time/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:assignedEntity/ext:id">
								<tr>
									<td>
										<span class="rowTitle">Tervishoiutöötaja kood</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:assignedEntity/ext:id/@extension"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:assignedEntity/ext:assignedPerson/ext:name">
								<tr>
									<td>
										<span class="rowTitle">Nimi</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:assignedEntity/ext:assignedPerson/ext:name/ext:given"/>
											<xsl:text>  </xsl:text>
											<xsl:value-of select="ext:assignedEntity/ext:assignedPerson/ext:name/ext:family"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:assignedEntity/ext:representedOrganization">
								<tr>
									<td>
										<span class="rowTitle">TTO asutus</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:assignedEntity/ext:representedOrganization/ext:id/@extension"/>
											<xsl:text>  </xsl:text>
											<xsl:value-of select="ext:assignedEntity/ext:representedOrganization/ext:name"/>
											<br/>
											<xsl:apply-templates select="ext:assignedEntity/ext:representedOrganization/ext:addr"/>
										</span>
									</td>
								</tr>
							</xsl:if>
						</xsl:for-each>
					</table>
				</td>
				<td>
					<table>
						<xsl:for-each select="ext:reference/ext:externalDocument">
							<xsl:if test="ext:id">
								<tr>
									<td>
										<span class="rowTitle">Dokumendi number</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:id/@extension"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:versionNumber">
								<tr>
									<td>
										<span class="rowTitle">Versioon</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:versionNumber/@value"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:code">
								<tr>
									<td>
										<span class="rowTitle">Dokumendi tüüp</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:code/@displayName"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="ext:text">
								<tr>
									<td>
										<span class="rowTitle">Kirjeldus</span>
										<xsl:text>  </xsl:text>
										<span class="rowValue">
											<xsl:value-of select="ext:text"/>
										</span>
									</td>
								</tr>
							</xsl:if>
						</xsl:for-each>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--

	Saatekirja suunatud uuringu template
	
	-->
	<xsl:template name="section.refs" match="urn:section" mode="refs">
		<table>
			<tr>
				<td colspan="4" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='formatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="urn:entry/urn:procedure">
							<tr class="rowTitle">
								<th>Teenus</th>
								<th>HK Hinnakirja kood</th>
								<th>Teised koodisüsteemid</th>
							</tr>
							<xsl:for-each select="urn:entry/urn:procedure">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:apply-templates select="urn:code" mode="formatting"/>
									</td>
									<td class="dataTableCell">
										<xsl:apply-templates select="urn:code[substring(@codeSystem,1,25)='1.3.6.1.4.1.28284.6.2.1.6']" mode="formatting"/>
									</td>
									<td class="dataTableCell">
										<xsl:for-each select="urn:code/urn:translation">
											<br/>
											<xsl:apply-templates select="." mode="formatting">
												<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
											</xsl:apply-templates>
											<br/>
										</xsl:for-each>
									</td>
								</tr>
							</xsl:for-each>
						</xsl:when>
						<xsl:when test="urn:entry/urn:encounter">
							<tr>
								<td colspan="4" class="blockLabel">
									<table>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:name">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Asutus</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:name"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:addr">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Aadress</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:apply-templates select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:addr"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<tr>
											<td colspan="3">
												<span class="rowTitle">Registreerimiskood</span>
												<xsl:text> </xsl:text>
												<span class="rowValue">
													<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:id/@extension"/>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="rowTitle">Telefon</span>
												<xsl:text> </xsl:text>
												<span class="rowValue">
													<xsl:value-of select="substring(urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:telecom[substring(@value,1,4)='tel:']/@value, 5)"/>
												</span>
											</td>
											<td colspan="2">
												<span class="rowTitle">Faks</span>
												<xsl:text> </xsl:text>
												<span class="rowValue">
													<xsl:value-of select="substring(urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:telecom[substring(@value,1,4)='fax:']/@value, 5)"/>
												</span>
											</td>
										</tr>
										<tr>
											<td colspan="3">
												<span class="rowTitle">E-post</span>
												<xsl:text> </xsl:text>
												<span class="rowValue">
													<xsl:value-of select="substring(urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:telecom[substring(@value,1,7)='mailto:']/@value, 8)"/>
												</span>
											</td>
										</tr>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:addr">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Tegevuskoha aadress</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:apply-templates select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:asOrganizationPartOf/urn:wholeOrganization/urn:addr"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:asOrganizationPartOf/urn:wholeOrganization/urn:asOrganizationPartOf/urn:code/@displayName">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Voodiprofiil</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:asOrganizationPartOf/urn:wholeOrganization/urn:asOrganizationPartOf/urn:code/@code"/> - 
														<xsl:apply-templates select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:asOrganizationPartOf/urn:wholeOrganization/urn:asOrganizationPartOf/urn:code/@displayName"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<!--
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:addr/urn:additionalLocator">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Kabinet</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:representedOrganization/urn:addr/urn:additionalLocator"/>
													</span>
												</td>
											</tr>
										</xsl:if>-->
										<xsl:if test="urn:entry/urn:encounter/urn:effectiveTime/@value">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Vastuvõtu aeg</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:call-template name="dateFormat">
															<xsl:with-param name="date" select="urn:entry/urn:encounter/urn:effectiveTime/@value"/>
															<xsl:with-param name="format" select="'time'"/>
														</xsl:call-template>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:assignedPerson">
											<tr>
												<td colspan="2">
													<span class="rowTitle">Arsti nimi</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:assignedPerson/urn:name/urn:given"/>
														<xsl:text> </xsl:text>
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:assignedPerson/urn:name/urn:family"/>
													</span>
												</td>
												<td>
													<span class="rowTitle">Arsti registreerimiskood</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/urn:id[@root='1.3.6.1.4.1.28284.6.2.4.9']/@extension"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/ext:asLicencedEntity">
											<tr>
												<td colspan="3">
													<span class="rowTitle">Eriala</span>
													<xsl:text> </xsl:text>
													<span class="rowValue">
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/ext:asLicencedEntity/ext:id/@extension"/> - 
														<xsl:value-of select="urn:entry/urn:encounter/urn:performer/urn:assignedEntity/ext:asLicencedEntity/ext:id/@assigningAuthorityName"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<tr>
											<td colspan="3">
												<span class="rowTitle">CITO!</span>
												<xsl:text> </xsl:text>
												<xsl:choose>
													<xsl:when test="urn:entry/urn:encounter/urn:priorityCode[@code='S']">
														<b>
															<font color="#ff0000">Jah</font>
														</b>
													</xsl:when>
													<xsl:otherwise>
														Ei
													</xsl:otherwise>
												</xsl:choose>
											</td>
										</tr>
										<xsl:if test="urn:entry/urn:encounter/urn:priorityCode[@code='S']">
											<tr>
												<td colspan="3">
													<span class="rowTitle">CITO! põhjendus</span>
													<xsl:text> </xsl:text>
													<xsl:value-of select="urn:entry/urn:encounter/urn:priorityCode/urn:originalText"/>
												</td>
											</tr>
										</xsl:if>
									</table>
								</td>
							</tr>
						</xsl:when>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--
	
	Saatekirja diagnoosi template

-->
	<xsl:template name="section.referralDiagnose" match="urn:section" mode="referralDiagnose">
		<table>
			<tr>
				<td class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<table>
								<tr>
									<td>
										<xsl:call-template name="diagnoses">
											<xsl:with-param name="list" select="urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']"/>
											<xsl:with-param name="showDate" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']/urn:effectiveTime)=0)"/>
											<xsl:with-param name="showRecurrency" select="not(count(urn:entry/urn:observation[urn:interpretationCode/@code='MAIN']/urn:value/urn:qualifier/urn:value)=0)"/>
											<xsl:with-param name="codeSystem" select="substring(urn:entry/urn:observation/urn:value/@codeSystem,1,26)"/>
											<xsl:with-param name="showOriginalText" select="'true'"/>
											<xsl:with-param name="showDiagnoos" select="'true'"/>
										</xsl:call-template>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	

Template for consultation
	-->
	<xsl:template name="section.consult" match="urn:section" mode="consult">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Saatekiri või saatekirja vastus</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:act">
				<!--Dokumendi kuupäev-->
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<xsl:for-each select="urn:reference/urn:externalDocument">
						<td class="dataTableCell">
							<table>
								<!--Dokumendi number-->
								<xsl:if test="urn:id">
									<tr>
										<td class="rowTitle">Dokumendi number:</td>
										<td>
											<xsl:value-of select="urn:id/@extension"/>
										</td>
									</tr>
								</xsl:if>
								<!--Dokumendi tüüp-->
								<xsl:if test="urn:code">
									<tr>
										<td class="rowTitle">Dokumendi tüüp:</td>
										<td>
											<xsl:apply-templates select="urn:code" mode="formatting"/>
										</td>
									</tr>
								</xsl:if>
								<!--Alternatiivkoodid-->
								<xsl:if test="urn:code/urn:translation">
									<xsl:for-each select="urn:code/urn:translation">
										<tr>
											<td class="rowTitle">Alternatiivkood:</td>
											<td>
												<xsl:apply-templates select="." mode="formatting">
													<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
												</xsl:apply-templates>
											</td>
										</tr>
									</xsl:for-each>
								</xsl:if>
								<!--Lisatekst-->
								<xsl:if test="urn:code/urn:originalText">
									<tr>
										<td class="rowTitle">Kirjeldus:</td>
										<td>
											<xsl:value-of select="urn:code/urn:originalText"/>
										</td>
									</tr>
								</xsl:if>
							</table>
						</td>
					</xsl:for-each>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--	

Template for pregnancyTable
	-->
	<xsl:template name="pregnancyTable" match="urn:section" mode="pregnancyTable">
		<table>
			<tr>
				<td class="blockLabel" colspan="19">
					Kestva raseduse vastuvõtud tabelina
				</td>
			</tr>
			<tr class="rowTitle">
				<th>Kuupäev</th>
				<th>Rasedusnädal</th>
				<th>Kaal</th>
				<th>Tursed</th>
				<th>Varikoosid</th>
				<th>Vererõhk vasak</th>
				<th>Vererõhk parem</th>
				<th>Emakapõhja kõrgus</th>
				<th>KTG</th>
				<th>Looteseis</th>
				<th>Loote südamelöögid</th>
				<th>Loote liigutused</th>
				<th>Hgb</th>
				<th>Valk</th>
				<th>Suhkur</th>
				<th>Sade</th>
				<th>AK</th>
				<th>Arst / Ämmaemand</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:encounter">
				<!--kuupäev-->
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
						&#160;	
					</td>
					<!--raseduse kestvus-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='57036006']">
							<xsl:value-of select="urn:value[@unit='wk']/@value"/>
							<xsl:if test="urn:value[@unit='d']">
								<xsl:text>+</xsl:text>
								<xsl:value-of select="urn:value[@unit='d']/@value"/>
							</xsl:if>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--kaal-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='363809009']">
							<xsl:value-of select="urn:value/@value"/>
						</xsl:for-each>
						&#160;			
						</td>
					<!--tursed-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='237285000']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--varikoosid-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='237345008']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;
						</td>
					<!--vererõhk vasak käsi-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='80768000']">
							<!--süstoolne-->
							<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271649006']/urn:value/@value"/>
							<xsl:text>/</xsl:text>
							<!--diastoolne-->
							<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271650006']/urn:value/@value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--vererõhk parem käsi-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='6921000']">
							<!--süstoolne-->
							<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271649006']/urn:value/@value"/>
							<xsl:text>/</xsl:text>
							<!--diastoolne-->
							<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='271650006']/urn:value/@value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--emakapõhja kõrgus-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='364265003']">
							<xsl:value-of select="urn:value/@value"/>
						</xsl:for-each>		
						&#160;	
						</td>
					<!--KTG-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='364363007']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--Loote seis-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='11368003']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='58865002']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='13712000']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;															
						</td>
					<!--Loote südamelöögid-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='249043002']">
							<xsl:value-of select="urn:value/@value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--Loote liigutused-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='163535001']">
							<xsl:value-of select="urn:value/@code"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--Hgb-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='275806002']">
							<xsl:value-of select="urn:value/@value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--Valk-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='167271000']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
								&#160;	
						</td>
					<!--Suhkur-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='167262009']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--Sade-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='102846009']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>	
						&#160;	
						</td>
					<!--AK-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='51481005']">
							<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
							<xsl:text>: </xsl:text>
							<xsl:choose>
								<xsl:when test="@negationInd='true'">
									<xsl:text>negatiivne</xsl:text>
								</xsl:when>
								<xsl:when test="@negationInd='false'">
									<xsl:text>positiivne</xsl:text>
								</xsl:when>
							</xsl:choose>
							<br/>
						</xsl:for-each>	
						&#160;	
						</td>
					<td class="dataTableCell">
						<!-- template for timeCriticalSource -->
						<xsl:call-template name="timeCriticalSourceAuthor">
							<xsl:with-param name="tabel" select="Jah"/>
						</xsl:call-template>
						&#160;	
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--	

Template for pelvis
	-->
	<xsl:template name="section.pelvis" match="urn:section" mode="pelvis">
		<table>
			<tr>
				<td class="blockLabel" colspan="3">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr class="rowTitle">
				<th rowspan="2">Kuupäev</th>
				<th rowspan="2">Rasedus- nädal</th>
				<th rowspan="2">Leid</th>
				<th rowspan="2">Perineum</th>
				<th colspan="2">Tupp</th>
				<th colspan="2">Emakakael</th>
				<th rowspan="2">Arst / Ämmaemand</th>
			</tr>
			<tr class="rowTitle">
				<th>limaskesta värvus</th>
				<th>vooluse hulk, iseloom</th>
				<th>asukoht</th>
				<th>konsistents</th>
			</tr>
			<xsl:for-each select="urn:entry/urn:procedure">
				<!--kuupäev-->
				<tr class="rowValue">
					<td class="dataTableCell">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
						&#160;	
					</td>
					<!--raseduse kestvus-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='366323009']">
							<xsl:value-of select="urn:value[@unit='wk']/@value"/>
							<xsl:if test="urn:value[@unit='d']">
								<xsl:text>+</xsl:text>
								<xsl:value-of select="urn:value[@unit='d']/@value"/>
							</xsl:if>
						</xsl:for-each>
						&#160;	
					</td>
					<td class="dataTableCell">
						<xsl:value-of select="urn:text"/>
						&#160;	
					</td>
					<!--perineum-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='265797005']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>
						&#160;	
					</td>
					<!--limaskesta värvus-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='276324000']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>
						&#160;	
					</td>
					<!--vooluse hulk ja iseloom-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='289568008']">
							<xsl:value-of select="urn:value"/>
						</xsl:for-each>
						&#160;	
					</td>
					<!--emakakaela asukoht-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='248920001']">
							<xsl:value-of select="urn:value/@code"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="urn:value/@displayName"/>
						</xsl:for-each>
						&#160;	
					</td>
					<!--emakakaela konsistents-->
					<td class="dataTableCell">
						<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='364282001']">
							<xsl:value-of select="urn:value/@code"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="urn:value/@displayName"/>
						</xsl:for-each>
						&#160;	
					</td>
					<!--allikas-->
					<td class="dataTableCell">
						<!-- template for timeCriticalSource -->
						<xsl:call-template name="timeCriticalSourceAuthor">
							<xsl:with-param name="tabel" select="Jah"/>
						</xsl:call-template>
						&#160;	
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!-- template immunizationData
-->
	<xsl:template name="immunizationData">
		<xsl:param name="healthcontrolType"/>
		<!-- 12H-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='12H'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1-5P-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='1-5P'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 1 kuu -->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='1K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 3 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='3K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 4,5 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='4,5K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 6 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='6K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='12K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 2 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='2A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 7 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='7A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 12 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='12A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--13 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='13A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--13 aastat 1 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='13A1K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!--13 aastat 7 kuud-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='13A7K'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
		<!-- 17 aastat-->
		<td class="rowValue">
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code=$healthcontrolType]">
				<xsl:if test="translate(urn:code/urn:qualifier/urn:value/@code,'hpka','HPKA')='17A'">
					<xsl:call-template name="observationData2">
						<xsl:with-param name="healthcontrolType" select="$healthcontrolType"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</td>
	</xsl:template>
	<!--Ravijuhtum-->
	<xsl:template name="careEncounter.encounter" match="urn:encompassingEncounter" mode="careEncounter">
		<table>
			<tr>
				<td colspan="2" class="blockLabel">Ravijuhtum</td>
			</tr>
			<xsl:if test="urn:id">
				<tr>
					<td class="rowTitle">Ravijuhtumi number</td>
					<td>
						<span class="rowValue">
							<xsl:value-of select="urn:id/@extension"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:code">
				<tr>
					<td class="rowTitle">Tüüp</td>
					<td>
						<span class="rowValue">
							<xsl:value-of select="urn:code/@displayName"/>
						</span>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td>
					<span class="rowTitle">Algus</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:low/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
				<td>
					<span class="rowTitle">Lõpp</span>
					<xsl:text> </xsl:text>
					<span class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/urn:high/@value"/>
							<xsl:with-param name="format" select="'time'"/>
						</xsl:call-template>
					</span>
				</td>
			</tr>
		</table>
	</xsl:template>
	<!--
	Template for performer-->
	<xsl:template name="performer" match="urn:performer">
		<tr>
			<td>
				<span class="rowTitle">Tervishoiutöötaja kood</span>
				<xsl:text>  </xsl:text>
				<span class="rowValue">
					<xsl:value-of select="urn:assignedEntity/urn:id/@extension"/>
				</span>
			</td>
		</tr>
		<tr>
			<td>
				<span class="rowTitle">Nimi</span>
				<xsl:text>  </xsl:text>
				<span class="rowValue">
					<xsl:value-of select="urn:assignedEntity/urn:assignedPerson/urn:name/urn:given"/>
					<xsl:text>  </xsl:text>
					<xsl:value-of select="urn:assignedEntity/urn:assignedPerson/urn:name/urn:family"/>
				</span>
			</td>
		</tr>
		<tr>
			<td>
				<span class="rowTitle">Eriala</span>
				<xsl:text>  </xsl:text>
				<span class="rowValue">
					<xsl:value-of select="urn:assignedEntity/ext:asLicencedEntity/ext:id/@extension"/> - 
											<xsl:value-of select="urn:assignedEntity/ext:asLicencedEntity/ext:id/@assigningAuthorityName"/>
				</span>
			</td>
		</tr>
		<xsl:if test="urn:assignedEntity/urn:representedOrganization">
			<tr>
				<td>
					<span class="rowTitle">TTO registrikood</span>
					<xsl:text>  </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:assignedEntity/urn:representedOrganization/urn:id/@extension"/>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="rowTitle">TTO nimi</span>
					<xsl:text>  </xsl:text>
					<span class="rowValue">
						<xsl:value-of select="urn:assignedEntity/urn:representedOrganization/urn:name"/>
					</span>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--

	Template for dentalVisit
	-->
	<xsl:template name="section.dentalVisit" match="urn:section" mode="dentalVisit">
		<xsl:param name="diagnose"/>
		<table>
			<tr>
				<td colspan="8" class="blockLabel">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="row"/>
				</xsl:when>
				<xsl:otherwise>
					<tr class="rowTitle">
						<th>Visiidi kuupäev</th>
						<xsl:if test="$diagnose='Jah'">
							<th>Diagnoos</th>
						</xsl:if>
						<th>Teenuse kood ja sisu</th>
						<th>Teostaja</th>
					</tr>
					<xsl:for-each select="urn:entry/urn:encounter">
						<xsl:variable name="rowNum" select="count(urn:entryRelationship/urn:procedure)"/>
						<xsl:for-each select="urn:entryRelationship/urn:procedure">
							<xsl:choose>
								<xsl:when test="position()=1">
									<tr class="rowValue">
										<!--visiidi kuupäev-->
										<td class="dataTableCell" rowspan="{$rowNum}">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="../../urn:effectiveTime/@value"/>
											</xsl:call-template>
												&#160;	
											</td>
										<xsl:if test="$diagnose='Jah'">
											<!--Diagnoosid-->
											<td class="dataTableCell" rowspan="{$rowNum}">
												<table>
													<xsl:for-each select="../../urn:entryRelationship/urn:observation">
														<tr>
															<td class="rowValue">
																<xsl:apply-templates select="urn:value" mode="diagnoses"/>
															</td>
														</tr>
													</xsl:for-each>
												</table>
											&#160;
										</td>
										</xsl:if>
										<!--Teostatud tööd-->
										<td class="dataTableCell">
											<xsl:call-template name="dentalProcedure"/>
										</td>
										<td class="dataTableCell">
											<table>
												<xsl:apply-templates select="urn:performer"/>
														&#160;
												</table>
										</td>
									</tr>
								</xsl:when>
								<xsl:otherwise>
									<tr class="rowValue">
										<!--Teostatud tööd-->
										<td class="dataTableCell">
											<xsl:call-template name="dentalProcedure"/>
										</td>
										<td class="dataTableCell">
											<table>
												<xsl:apply-templates select="urn:performer"/>
														&#160;
												</table>
										</td>
									</tr>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:for-each>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	


	Template for dentalProcedure
	-->
	<xsl:template name="dentalProcedure">
		<table>
			<tr>
				<td class="rowTitle">Kood</td>
				<td class="rowValue">
					<xsl:value-of select="urn:code/@code"/>
					<xsl:text> - </xsl:text>
					<xsl:value-of select="urn:code/@displayName"/>
					<br/>
					<!--Alternatiivkoodid-->
					<xsl:for-each select="urn:code/urn:translation">
						<br/>
						<xsl:apply-templates select="." mode="formatting">
							<xsl:with-param name="showCodeSystemName" select="@codeSystemName"/>
						</xsl:apply-templates>
					</xsl:for-each>
				</td>
			</tr>
			<xsl:if test="urn:code/urn:originalText">
				<tr>
					<td class="rowTitle">Sisu</td>
					<td class="rowValue">
						<xsl:value-of select="urn:code/urn:originalText"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:text">
				<tr>
					<td class="rowTitle">Märkus</td>
					<td class="rowValue">
						<xsl:value-of select="urn:text"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:targetSiteCode">
				<tr>
					<td class="rowTitle">Hambavalemid</td>
					<td class="rowValue">
						<xsl:for-each select="urn:targetSiteCode">
							<xsl:value-of select="@code"/>
							<xsl:if test="urn:qualifier/urn:value/@code">
								<sup>
									<xsl:for-each select="urn:qualifier/urn:value">
										<xsl:choose>
											<xsl:when test="substring(@code,1,1)='L'">
												<xsl:value-of select="substring(@code,4,1)"/>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="substring(@code,3,1)"/>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:for-each>
								</sup>
							</xsl:if>
							<xsl:if test="not(position()=last())">
								<xsl:text>, </xsl:text>
							</xsl:if>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--	


	Template for patientHealthData
	-->
	<xsl:template name="section.healthData" match="urn:section" mode="healthData">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td class="blockLabel" colspan="3">Üldanamnees</td>
					</tr>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='STATE']">
						<tr>
							<td class="rowTitle">Üldseisund <xsl:call-template name="dateFormat">
									<xsl:with-param name="date" select="urn:entry/urn:observation[urn:code/@code='STATE']/urn:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='STATE']/urn:value"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='162842001']">
						<tr>
							<td class="rowTitle">Üldine füsioloogiline areng</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='162842001']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='405136000']">
						<tr>
							<td class="rowTitle">Kahjulikud harjumused</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='405136000']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='410547008']">
						<tr>
							<td class="rowTitle">Põetud haigused (ütluspõhine)</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='410547008']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='413320001' and urn:code/urn:qualifier/urn:value/@code='401059001']">
						<tr>
							<td class="rowTitle">Terviseprobleemid/kasutatavad ravimid (ütluspõhine)</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='413320001' and urn:code/urn:qualifier/urn:value/@code='401059001']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='418925002']">
						<tr>
							<td class="rowTitle">Allergia (ütluspõhine)</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='418925002']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='105448009']">
						<tr>
							<td class="rowTitle">Hambumusanomaalia lähisugulastel</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='105448009']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<tr>
						<td class="blockLabel" colspan="3">Patsiendi suu- ja hammaskonna anamnees</td>
					</tr>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='406524005']">
						<tr>
							<td class="rowTitle" width="20%">Pöördumise põhjus</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='406524005']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='110476007']">
						<tr>
							<td class="rowTitle">Motivatsioon</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='110476007']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='66471008']">
						<tr>
							<td class="rowTitle">Neelamistüüp</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='66471008']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='366141005']">
						<tr>
							<td class="rowTitle">Hingamisprobleemid</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='366141005']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='268972001']">
						<tr>
							<td class="rowTitle">Kõnedefektid, logopeediline ravi</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='268972001']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter[urn:code/@code='71369009']">
						<tr>
							<td class="rowTitle">Varasem ortodontiline ravi</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:encounter[urn:code/@code='71369009']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:encounter[urn:code/@code='34043003']">
						<tr>
							<td class="rowTitle">Varasem hambaravi</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:encounter[urn:code/@code='34043003']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='82271004']">
						<tr>
							<td class="rowTitle">Traumad (ütluspõhine)</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='82271004']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='278608002']">
						<tr>
							<td class="rowTitle">Hambaproteesid</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='278608002']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='309657003']">
						<tr>
							<td class="rowTitle">Parodontoloogiline anamnees</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='309657003']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='163152009']">
						<tr>
							<td class="rowTitle">Karioloogiline anamnees</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='163152009']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='278430006']">
						<tr>
							<td colspan="2">
								<xsl:call-template name="section.orthodonticRetainer"/>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	


	Template for anomaly
	-->
	<xsl:template name="section.anomaly" match="urn:section" mode="anomaly">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td colspan="2">
							<table>
								<tr class="rowTitle">
									<th>Diagnoosid</th>
									<th>Ravivõimalused</th>
									<th>Patsiendi valik</th>
								</tr>
								<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='182890002']">
									<xsl:variable name="rowNum" select="count(urn:entryRelationship/urn:act)"/>
									<xsl:for-each select="urn:entryRelationship/urn:act">
										<xsl:choose>
											<xsl:when test="position()=1">
												<tr class="rowValue">
													<td class="dataTableCell" rowspan="{$rowNum}">
														<xsl:for-each select="../../urn:entryRelationship/urn:observation/urn:value">
															<xsl:apply-templates select="." mode="diagnoses"/>
															<br/>
														</xsl:for-each>
													</td>
													<td class="dataTableCell">
														<xsl:value-of select="urn:text"/>
													</td>
													<td class="dataTableCell">
														<xsl:if test="urn:code/urn:qualifier/urn:value/@code='314846003'">
															<xsl:text>Valitud!</xsl:text>
														</xsl:if>
																&#160;
														</td>
												</tr>
											</xsl:when>
											<xsl:otherwise>
												<tr class="rowValue">
													<td class="dataTableCell">
														<xsl:value-of select="urn:text"/>
													</td>
													<td class="dataTableCell">
														<xsl:if test="urn:code/urn:qualifier/urn:value/@code='314846003'">
															<xsl:text>Valitud!</xsl:text>
														</xsl:if>
																&#160;
														</td>
												</tr>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:for-each>
								</xsl:for-each>
							</table>
						</td>
					</tr>
					<tr>
						<td class="rowTitle">Planeeritud ekstraktsioonid</td>
						<td class="rowValue">
							<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='55162003']">
								<span class="rowValue">
									<xsl:value-of select="urn:targetSiteCode/@code"/>
									<xsl:if test="not(position()=last())">
										<xsl:text>, </xsl:text>
									</xsl:if>
								</span>
							</xsl:for-each>
						</td>
					</tr>
					<tr>
						<td class="rowTitle">Vastunäidustused</td>
						<td class="rowValue">
							<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='397745006']">
								<span class="rowValue">
									<xsl:value-of select="urn:value/@displayName"/>
									<xsl:if test="urn:value/urn:originalText">
										<xsl:text>: </xsl:text>
										<xsl:value-of select="urn:value/urn:originalText"/>
									</xsl:if>
									<br/>
								</span>
							</xsl:for-each>
						</td>
					</tr>
					<tr>
						<td class="rowTitle">Komplikatsioonid</td>
						<td class="rowValue">
							<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='116223007']">
								<span class="rowValue">
									<xsl:value-of select="urn:value/@displayName"/>
									<xsl:if test="urn:value/urn:originalText">
										<xsl:text>: </xsl:text>
										<xsl:value-of select="urn:value/urn:originalText"/>
									</xsl:if>
									<br/>
								</span>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	

	Template for treatmentPlan
	-->
	<xsl:template name="section.treatmentPlan" match="urn:section" mode="treatmentPlan">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<tr>
				<td class="rowTitle" width="25%">Ravi alustamise esimese visiidi kuupäev</td>
				<td class="rowValue">
					<xsl:call-template name="dateFormat">
						<xsl:with-param name="date" select="urn:entry/urn:encounter[urn:code/@code='413946009']/urn:effectiveTime/@value"/>
					</xsl:call-template>
				</td>
			</tr>
			<xsl:if test="urn:entry/urn:encounter[urn:code/@code='226028008'] and //urn:ClinicalDocument/urn:code[@code='23' or @code='27']">
				<tr>
					<td class="rowTitle" colspan="2">Aparaatravi</td>
				</tr>
				<tr>
					<td colspan="2">
						<table>
							<tr class="rowTitle">
								<th>Kestvus kuudes</th>
								<th>Raviaparaadi tüüp</th>
							</tr>
							<xsl:for-each select="urn:entry/urn:encounter[urn:code/@code='226028008']">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:value-of select="urn:effectiveTime/urn:width/@value"/>
							&#160;
							</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:entryRelationship/urn:supply/urn:text"/>
							&#160;	
							</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:entry/urn:encounter[urn:code/@code='226028008'] and //urn:ClinicalDocument/urn:code[@code='35' or @code='34']">
				<tr>
					<td class="rowTitle" colspan="2">Ravi</td>
				</tr>
				<tr>
					<td colspan="2">
						<table>
							<tr class="rowTitle">
								<th>Kestvus</th>
								<th>Ravi kirjeldus</th>
							</tr>
							<xsl:for-each select="urn:entry/urn:encounter[urn:code/@code='226028008']">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:value-of select="urn:effectiveTime/urn:width/@value"/>
										<xsl:text>  </xsl:text>
										<xsl:call-template name="dateUnit">
											<xsl:with-param name="one" select="urn:effectiveTime/urn:width/@value"/>
											<xsl:with-param name="unit" select="urn:effectiveTime/urn:width/@unit"/>
										</xsl:call-template>
							&#160;
							</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:text"/>
							&#160;	
							</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="urn:entry/urn:encounter[urn:code/@code='278430006']">
				<tr>
					<td class="rowTitle" colspan="2">Retensiooniperioodi kestvus ja retensiooniaparaadi tüüp</td>
				</tr>
				<tr>
					<td colspan="2">
						<table>
							<tr class="rowTitle">
								<th/>
								<th>Kestvus kuudes</th>
								<th>Aparaadi tüüp</th>
								<th>Aparaadi kirjeldus</th>
							</tr>
							<xsl:for-each select="urn:entry/urn:encounter/urn:entryRelationship/urn:procedure">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:if test="urn:targetSiteCode/@code='181812008'">
											<xsl:text>Alakaar</xsl:text>
										</xsl:if>
										<xsl:if test="urn:targetSiteCode/@code='181813003'">
											<xsl:text>Ülakaar</xsl:text>
										</xsl:if>
									</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:effectiveTime/urn:width/@value"/>
							&#160;
							</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:entryRelationship/urn:supply/urn:code/@displayName"/>
							&#160;	
							</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:entryRelationship/urn:supply/urn:text"/>
							&#160;	
							</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
	<!--	
	Template for teethRadiography
	-->
	<xsl:template name="section.teethRadiography" match="urn:section" mode="teethRadiography">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='22891007']">
						<tr>
							<td class="dataTableCell">
								<table>
									<tr>
										<td class="rowTitle" width="20%">Toimumise kuupäev</td>
										<td class="rowValue" width="80%">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
											</xsl:call-template>
										</td>
									</tr>
									<tr>
										<td class="rowTitle" width="20%">Teostaja</td>
										<td class="rowValue" width="80%">
											<table>
												<xsl:for-each select="urn:performer">
													<xsl:apply-templates select="."/>
												</xsl:for-each>
											</table>
							&#160;
							</td>
									</tr>
									<tr>
										<td colspan="2" width="100%">
											<table>
												<tr class="rowTitle">
													<th colspan="2" align="left">Probleemsed hambad</th>
												</tr>
												<tr class="rowTitle">
													<th width="10%">Hambavalem</th>
													<th width="90%">Leid</th>
												</tr>
												<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='278544002']">
													<tr class="rowValue">
														<td class="dataTableCell">
															<xsl:value-of select="urn:targetSiteCode/@code"/>
											&#160;
							</td>
														<td class="dataTableCell">
															<xsl:value-of select="urn:text"/>
							&#160;	
							</td>
													</tr>
												</xsl:for-each>
											</table>
										</td>
									</tr>
									<tr>
										<td class="rowTitle" width="20%">Regulaarselt röntegnkontrolli vajavad hambad</td>
										<td class="rowValue" width="80%">
											<xsl:for-each select="urn:entryRelationship/urn:observation[urn:code/@code='169116004']/urn:targetSiteCode">
												<xsl:sort select="@code"/>
												<xsl:value-of select="@code"/>
												<xsl:if test="not(position()=last())">
													<xsl:text>, </xsl:text>
												</xsl:if>
											</xsl:for-each>
										</td>
									</tr>
									<tr>
										<td class="rowTitle" width="20%">Pildiviit</td>
										<td class="rowValue" width="80%">
											<xsl:value-of select="urn:reference/urn:externalDocument/urn:id/@root"/>
											<br/>
											<xsl:value-of select="urn:reference/urn:externalDocument/urn:id/@extension"/>
											&#160;
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	
	Template for panoramRadiography
	-->
	<xsl:template name="section.PanoramRadiography" match="urn:section" mode="PanoramRadiography">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<table>
								<tr class="rowTitle">
									<th>Kuupäev</th>
									<th>Kirjeldus</th>
									<th>Teostaja</th>
									<th>Pildiviit</th>
								</tr>
								<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='89846007']">
									<tr class="rowValue">
										<td class="dataTableCell">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
											</xsl:call-template>
											&#160;
										</td>
										<td class="dataTableCell">
											<xsl:value-of select="urn:text"/>
											&#160;
										</td>
										<td class="dataTableCell">
											<table>
												<xsl:for-each select="urn:performer">
													<xsl:apply-templates select="."/>
												</xsl:for-each>
											</table>
										&#160;
										</td>
										<td class="dataTableCell">
											<xsl:value-of select="urn:reference/urn:externalDocument/urn:id/@root"/>
											<br/>
											<xsl:value-of select="urn:reference/urn:externalDocument/urn:id/@extension"/>
											&#160;
										</td>
									</tr>
								</xsl:for-each>
							</table>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	


	Template for cephalogram
	-->
	<xsl:template name="section.cephalogram" match="urn:section" mode="cephalogram">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='362637005']">
						<tr>
							<td class="dataTableCell">
								<table>
									<tr>
										<td class="rowTitle">Toimumise kuupäev</td>
										<td class="rowValue">
											<xsl:call-template name="dateFormat">
												<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
											</xsl:call-template>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Teostaja</td>
										<td class="rowValue">
											<table>
												<xsl:for-each select="urn:performer">
													<xsl:apply-templates select="."/>
												</xsl:for-each>
											</table>
							&#160;
							</td>
									</tr>
									<tr>
										<td class="rowTitle">Kirjeldus</td>
										<td class="rowValue">
											<xsl:value-of select="urn:code/urn:originalText"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">SNA (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='SNA']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">SNB (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='SNB']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">ANB (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='ANB']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Wits (mm)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='Wits']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Ui/Mxp (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='Ui/Mxp']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Li/Mndp (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='Li/Mndp']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">SN/Mndp (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='SN/Mndp']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Mx/Mndp (nurgamõõt kraadides)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='Mx/Mndp']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">FP (%)</td>
										<td class="rowValue">
											<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='FP']/urn:value/@value"/>
										</td>
									</tr>
									<tr>
										<td class="rowTitle">Kokkuvõte</td>
										<td class="rowValue">
											<xsl:value-of select="urn:text"/>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	


	Template for clinicalObservation - Kliiniline vaatlus
	-->
	<xsl:template name="section.clinicalObservation" match="urn:section" mode="clinicalObservation">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='15253005' or urn:code/@code='364717003' or urn:code/@code='425845008' or urn:code/@code='251300005' or 
				urn:code/@code='301347005' or urn:code/@code='235085008' or urn:code/@code='128975004' or urn:code/@code='196398003' 
				or urn:code/@code='301855007' or urn:code/@code='271612000' or urn:code/@code='25903009' or urn:code/@code='120230007' 
				or urn:code/@code='225545000']">
						<tr>
							<td class="blockLabel" colspan="2">EXTRAORALIS:</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='15253005'">
						<tr>
							<td class="rowTitle" width="20%">Näo asümmeetria</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='15253005']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='364717003'">
						<tr>
							<td class="rowTitle">Näo profiil</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='364717003']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='425845008' and urn:targetSiteCode/@code='181813003']">
						<tr>
							<td class="rowTitle">Ülalõualuu asend vaatlusel</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='425845008' and urn:targetSiteCode/@code='181813003']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='425845008' and urn:targetSiteCode/@code='181812008']">
						<tr>
							<td class="rowTitle">Alalõualuu asend vaatlusel</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='425845008' and urn:targetSiteCode/@code='181812008']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='251300005'">
						<tr>
							<td class="rowTitle">Näo ala- ja keskosa kõrguste suhe</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='251300005']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='301347005'">
						<tr>
							<td class="rowTitle">Huuled</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='301347005']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='235085008'">
						<tr>
							<td class="rowTitle" colspan="3">
								<b>Ülemiste intsisiivide ja ülahuule suhe:</b>
							</td>
						</tr>
						<tr>
							<td colspan="3">
								<table>
									<tr class="rowTitle">
										<th>asend</th>
										<th>suhe</th>
										<th>mõõt (mm)</th>
									</tr>
									<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='235085008']">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:choose>
													<xsl:when test="urn:methodCode/@code='248174008'">
														<xsl:text>huulte asend</xsl:text>
													</xsl:when>
													<xsl:when test="urn:methodCode/@code='51078006'">
														<xsl:text>naeratades</xsl:text>
													</xsl:when>
												</xsl:choose>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:value/@displayName"/>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:value/@value"/>
											</td>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='128975004'">
						<tr>
							<td class="rowTitle">Huulte asend puhkeseisundis</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='128975004' and urn:methodCode/@code='128975004']/urn:value/@displayName"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='196398003'">
						<tr>
							<td class="rowTitle" colspan="3">
								<b>Hambakaarte keskjoonte ja näo keskjoone suhe:</b>
							</td>
						</tr>
						<tr>
							<td colspan="3">
								<table>
									<tr class="rowTitle">
										<th>asukoht</th>
										<th>suund</th>
										<th>mõõt (mm)</th>
									</tr>
									<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='196398003']">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:if test="urn:targetSiteCode/@code='181812008'">
													<xsl:text>Alalõualuu</xsl:text>
												</xsl:if>
												<xsl:if test="urn:targetSiteCode/@code='181813003'">
													<xsl:text>Ülalõualuu</xsl:text>
												</xsl:if>
											</td>
											<td class="dataTableCell">
												<xsl:choose>
													<xsl:when test="urn:value/@code='272138001'">
														<xsl:text>paremale</xsl:text>
													</xsl:when>
													<xsl:when test="urn:value/@code='272139009'">
														<xsl:text>vasakule</xsl:text>
													</xsl:when>
												</xsl:choose>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:value/@value"/>
											</td>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='301855007'">
						<tr>
							<td class="rowTitle">Lümfisõlmed</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='301855007']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='271612000'">
						<tr>
							<td class="rowTitle">Süljenäärmed</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='271612000']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='120230007'">
						<tr>
							<td class="rowTitle">Liigesed</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='120230007']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='25903009'">
						<tr>
							<td class="rowTitle">Lihased</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='25903009']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='225545000'">
						<tr>
							<td class="rowTitle">Nahamuutused</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='225545000']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='107645002' or urn:code/@code='20043004' or urn:code/@code='110298001' or urn:code/@code='109628004' or 
					urn:code/@code='286546002' or urn:code/@code='43341003' or urn:code/@code='47944004' or urn:code/@code='12264001' or urn:code/@code='251292006' or 
					urn:code/@code='23234003' or urn:code/@code='109495004' or urn:code/@code='93154004' or urn:code/@code='24617007' or urn:code/@code='181256000' or 
					urn:code/@code='35591002' or urn:code/@code='109652006' or urn:code/@code='109658005' or urn:code/@code='109797006' or urn:code/@code='4356008' or 
					urn:code/@code='251309006' or urn:code/@code='251314005' or urn:code/@code='364126007' or urn:code/@code='249420004' or urn:code/@code='251311002'
					or urn:code/@code='2556008' or urn:code/@code='4356008' or urn:code/@code='278430006']">
						<tr>
							<td class="blockLabel" colspan="3">INTRAORALIS:</td>
						</tr>
					</xsl:if>
					<!--indeksid-->
					<xsl:if test="urn:entry/urn:observation/urn:code[@code='251309006' or @code='251314005' or @code='364126007' or @code='249420004' or @code='251311002']">
						<tr>
							<td colspan="3">
								<xsl:call-template name="section.teethIndex"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='20043004' and urn:targetSiteCode/@code='264488001']">
						<tr>
							<td class="rowTitle">Ülahuulekida kinnitus</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='20043004' and urn:targetSiteCode/@code='264488001']/urn:value/@displayName"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='20043004' and urn:targetSiteCode/@code='264488001']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='277191003']">
						<tr>
							<td class="rowTitle">Alahuulekida suurus</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='277191003']/urn:value/@displayName"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='277191003']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='46005001' and urn:targetSiteCode/@code='277191003']">
						<tr>
							<td class="rowTitle">Alahuulekida kinnitus</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='46005001' and urn:targetSiteCode/@code='277191003']/urn:value/@displayName"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='46005001' and urn:targetSiteCode/@code='277191003']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='110298001'">
						<tr>
							<td class="rowTitle">Suuõõne hügieen</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='110298001']/urn:value/@displayName"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='110298001']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='249400000'">
						<tr>
							<td class="rowTitle">Limaskestad</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='249400000']/urn:text"/>
							</td>
						</tr>
					</xsl:if>
					<!--Üldine parodontoloogiline diagnoos-->
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='2556008'">
						<tr>
							<td class="rowTitle" colspan="3">
								<b>Üldine parodontoloogiline diagnoos</b>
							</td>
						</tr>
						<xsl:if test="urn:entry/urn:observation[urn:code/@code='2556008']/urn:author">
							<tr>
								<td class="rowTitle">Allikas</td>
								<td class="rowValue" colspan="2">
									<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='2556008']">
										<xsl:call-template name="timeCriticalSourceAuthor">
											<xsl:with-param name="tabel" select="'Jah'"/>
										</xsl:call-template>
									</xsl:for-each>
								</td>
							</tr>
						</xsl:if>
						<tr>
							<td class="rowTitle" width="20%">Diagnoos</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='2556008']/urn:value/@code"/>
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='2556008']/urn:value/@displayName"/>
							</td>
						</tr>
						<tr>
							<td class="rowTitle" width="20%">Arsti sõnaline diagnoos</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='2556008']/urn:value/urn:originalText"/>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='264488001']">
						<tr>
							<td class="rowTitle">Ülahuulekida suurus</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='264488001']/urn:value/@displayName"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='107645002' and urn:targetSiteCode/@code='264488001']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='109652006' or urn:code/@code='109658005']">
						<tr>
							<td class="rowTitle" colspan="3">
								<b>Ruumi olemasolu:</b>
							</td>
						</tr>
						<tr>
							<td colspan="3">
								<table>
									<tr class="rowTitle">
										<th>hambakaar</th>
										<th>ruumi olemasolu</th>
										<th>ruum</th>
										<th>kirjeldus</th>
										<xsl:if test="urn:entry/urn:observation[urn:code/@code='109652006' or urn:code/@code='109658005']/urn:statusCode/@code='completed'">
											<th/>
										</xsl:if>
									</tr>
									<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='109652006' or urn:code/@code='109658005']">
										<tr class="rowValue">
											<td class="dataTableCell">
												<xsl:choose>
													<xsl:when test="urn:targetSiteCode/@code='245549000'">
														<xsl:text>ülemine hambakaar</xsl:text>
													</xsl:when>
													<xsl:when test="urn:targetSiteCode/@code='245550000'">
														<xsl:text>alumine hambakaar</xsl:text>
													</xsl:when>
												</xsl:choose>
											</td>
											<td class="dataTableCell">
												<xsl:choose>
													<xsl:when test="urn:code/@code='109652006'">
														<xsl:text>ruumi puudus</xsl:text>
													</xsl:when>
													<xsl:when test="urn:code/@code='109658005'">
														<xsl:text>ruumi ülejääk</xsl:text>
													</xsl:when>
												</xsl:choose>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:value/@displayName"/>
											</td>
											<td class="dataTableCell">
												<xsl:value-of select="urn:text"/>
											</td>
											<xsl:if test="urn:statusCode/@code='completed'">
												<td>
													<font color="#ff0000">lõpetatud!</font>
												</td>
											</xsl:if>
										</tr>
									</xsl:for-each>
								</table>
							</td>
						</tr>
					</xsl:if>
					<!--ortodontiline aparaat-->
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='278430006'">
						<tr>
							<td colspan="3">
								<xsl:call-template name="section.orthodonticRetainer"/>
							</td>
						</tr>
					</xsl:if>
					<!--hinnangud-->
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='270479002']">
						<tr>
							<td colspan="3">
								<xsl:call-template name="section.teethFinding"/>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	


	Template for tempMovement - Liigese ja lihaste funktsioonide hindamine
	-->
	<xsl:template name="section.tempMovement" match="urn:section" mode="tempMovement">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:value-of select="urn:title"/>
				</td>
			</tr>
			<xsl:choose>
				<xsl:when test="urn:text/@styleCode='xformatted'">
					<xsl:apply-templates select="urn:text" mode="text"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='262016004'">
						<tr>
							<td class="rowTitle">Suu maksimaalne avamine (mm)</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='262016004']/urn:value/@value"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='262016004']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='KoodAlalouaLiikuvus'">
						<tr>
							<td class="rowValue" colspan="3">
								<table>
									<tr class="rowTitle">
										<td colspan="3">
											<b>Alalõua liikuvus (mm):</b>
										</td>
									</tr>
									<tr class="rowTitle">
										<th>paremale</th>
										<th>vasakule</th>
										<th>taha suunas</th>
									</tr>
									<tr class="rowValue">
										<td class="dataTableCell">
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='272138001']/urn:value/@value"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='272138001']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>
										&#160;
									</td>
										<td class="dataTableCell">
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='272139009']/urn:value/@value"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='272139009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>
										&#160;									
									</td>
										<td class="dataTableCell">
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='312004007']/urn:value/@value"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='KoodAlalouaLiikuvus' and urn:code/urn:qualifier/urn:value/@code='312004007']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>
										&#160;	
									</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='276396009'">
						<tr>
							<td class="rowValue" colspan="3">
								<table>
									<tr class="rowTitle">
										<td colspan="3">
											<b>Suunamuutused avamisel ja sulgedes:</b>
										</td>
									</tr>
									<tr class="rowTitle">
										<th>avamisel</th>
										<th>sulgedes</th>
									</tr>
									<tr class="rowValue">
										<td class="dataTableCell">
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='109638009']/urn:code/urn:qualifier">
													<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='109638009']/urn:code/urn:qualifier/urn:value/@displayName"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='109638009']/@negationInd='true'">
														<xsl:text>puudub</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='109638009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>
											&#160;
									</td>
										<td class="dataTableCell">
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='1284000']/urn:code/urn:qualifier">
													<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='1284000']/urn:code/urn:qualifier/urn:value/@displayName"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='1284000']/@negationInd='true'">
														<xsl:text>puudub</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='276396009' and urn:methodCode/@code='1284000']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='298376001'">
						<tr>
							<td class="rowValue" colspan="3">
								<table>
									<tr class="rowTitle">
										<td colspan="4">
											<b>Valud alalõualiigeses:</b>
										</td>
									</tr>
									<tr>
										<td width="20%" class="rowTitle">Kirjeldus:</td>
										<td colspan="3" class="rowValue">
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='298376001']/urn:text"/>
										</td>
									</tr>
									<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:statusCode/@code='completed'">
										<tr>
											<td width="20%" class="rowTitle">Staatus:</td>
											<td colspan="3" class="rowValue">
												<font color="#ff0000"> lõpetatud!</font>
											</td>
										</tr>
									</xsl:if>
									<tr class="rowTitle">
										<th colspan="2">parem</th>
										<th colspan="2">vasak</th>
									</tr>
									<tr class="rowTitle">
										<th>avades</th>
										<th>sulgedes</th>
										<th>avades</th>
										<th>sulgedes</th>
									</tr>
									<tr class="rowValue">
										<td class="dataTableCell">
											<!--parem, avades-->
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='109638009']/@negationInd='true'">
													<xsl:text>ei ole</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='109638009']/@negationInd='false'">
														<xsl:text>on</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='109638009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--parem, sulgedes-->
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='1284000']/@negationInd='true'">
													<xsl:text>ei ole</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='1284000']/@negationInd='false'">
														<xsl:text>on</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='1284000']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--vasak, avades-->
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='109638009']/@negationInd='true'">
													<xsl:text>ei ole</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='109638009']/@negationInd='false'">
														<xsl:text>on</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='109638009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>		
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--vasak, sulgedes-->
											<xsl:choose>
												<xsl:when test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='1284000']/@negationInd='true'">
													<xsl:text>ei ole</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='1284000']/@negationInd='false'">
														<xsl:text>on</xsl:text>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='298376001']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='1284000']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>		
									&#160;				
									</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation/urn:code/@code='196432004'">
						<tr>
							<td class="rowValue" colspan="3">
								<table>
									<tr class="rowTitle">
										<td colspan="4">
											<b>Helid alalõualiigeses:</b>
										</td>
									</tr>
									<tr>
										<td width="20%" class="rowTitle">Kirjeldus:</td>
										<td colspan="3" class="rowValue">
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='196432004']/urn:text"/>
										</td>
									</tr>
									<xsl:if test="urn:entry/urn:observation[urn:code/@code='196432004']/urn:statusCode/@code='completed'">
										<tr>
											<td width="20%" class="rowTitle">Staatus:</td>
											<td colspan="3" class="rowValue">
												<font color="#ff0000"> lõpetatud!</font>
											</td>
										</tr>
									</xsl:if>
									<tr class="rowTitle">
										<th colspan="2">parem</th>
										<th colspan="2">vasak</th>
									</tr>
									<tr class="rowTitle">
										<th>avades</th>
										<th>sulgedes</th>
										<th>avades</th>
										<th>sulgedes</th>
									</tr>
									<tr class="rowValue">
										<td class="dataTableCell">
											<!--parem, avades-->
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='109638009']/urn:value/@displayName"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='109638009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--parem, sulgedes-->
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='1284000']/urn:value/@displayName"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362626009' and urn:methodCode/@code='1284000']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--vasak, avades-->
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='109638009']/urn:value/@displayName"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='109638009']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
										<td class="dataTableCell">
											<!--vasak, sulgedes-->
											<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='1284000']/urn:value/@displayName"/>
											<xsl:if test="urn:entry/urn:observation[urn:code/@code='196432004']/urn:entryRelationship/urn:observation[urn:targetSiteCode/@code='362627000' and urn:methodCode/@code='1284000']/urn:statusCode/@code='completed'">
												<font color="#ff0000"> lõpetatud!</font>
											</xsl:if>	
									&#160;				
									</td>
									</tr>
								</table>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181738000']">
						<tr>
							<td class="rowTitle">Mälumislihaste tundlikkus palpeerimisel</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181738000']/urn:text"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181738000']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181814009']">
						<tr>
							<td class="rowTitle">Alalõualiigese tundlikkus palpeerimisel</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181814009']/urn:text"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='113011001' and urn:targetSiteCode/@code='181814009']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
					<xsl:if test="urn:entry/urn:observation[urn:code/@code='365853002']">
						<tr>
							<td class="rowTitle">Röntgenoloogiline leid</td>
							<td class="rowValue">
								<xsl:value-of select="urn:entry/urn:observation[urn:code/@code='365853002']/urn:text"/>
							</td>
							<td class="rowValue">
								<xsl:if test="urn:entry/urn:observation[urn:code/@code='365853002']/urn:statusCode/@code='completed'">
									<font color="#ff0000">lõpetatud!</font>
								</xsl:if>
							</td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>
	<!--	
	Template for HambaStaatus
	-->
	<xsl:template name="hambaStaatus">
		<xsl:param name="hambaSt"/>
		<table>
			<xsl:if test="urn:effectiveTime">
				<tr>
					<td class="rowTitle" width="20%">kuupäev</td>
					<td class="rowValue">
						<xsl:call-template name="dateFormat">
							<xsl:with-param name="date" select="urn:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="$hambaSt='Jah'">
				<tr>
					<td class="rowTitle" width="20%">hambavalem ja staatus</td>
					<td class="rowValue">
						<xsl:call-template name="teethNumberAndStatus"/>
					</td>
				</tr>
			</xsl:if>
			<!--Igemetasku sügavus, igeme taandumine, sagitaalne lahi, asendi anomaalia, kattumise sügavus-->
			<xsl:if test="urn:code/@code='286546002' or urn:code/@code='4356008' or urn:code/@code='251292006' or urn:code/@code='181256000' or urn:code/@code='23234003'">
				<tr>
					<td class="rowTitle" width="20%">hambavalem</td>
					<td class="rowValue">
						<xsl:value-of select="urn:targetSiteCode/@code"/>
					</td>
				</tr>
			</xsl:if>
			<!--molaaride, kaniinide asend-, diasteem, eelkontaktid-->
			<xsl:if test="urn:code/@code='47944004' or urn:code/@code='12264001' or urn:code/@code='35591002' or urn:code/@code='109797006'">
				<tr>
					<td class="rowTitle" width="20%">hambavalem</td>
					<td class="rowValue">
						<xsl:for-each select="urn:targetSiteCode">
							<xsl:sort select="@code"/>
							<xsl:value-of select="@code"/>
							<xsl:if test="position()=1">
								<xsl:text>/</xsl:text>
							</xsl:if>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:if>
			<!--risthambumus, käärhambumus, vertikaalne lahi-->
			<xsl:if test="urn:code/@code='109495004' or urn:code/@code='93154004' or urn:code/@code='24617007'">
				<tr>
					<td class="rowTitle" width="20%">hambavalem</td>
					<td class="rowValue">
						<xsl:for-each select="urn:targetSiteCode">
							<xsl:value-of select="@code"/>
							<xsl:if test="not(position()=last())">
								<xsl:text>,</xsl:text>
							</xsl:if>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:if>
			<!--hamba staatuse nimetus-->
			<xsl:if test="$hambaSt='Jah'">
				<xsl:if test="urn:value/urn:originalText or urn:code/urn:originalText or urn:entryRelationship/urn:observation/urn:value/urn:originalText">
					<tr>
						<td class="rowTitle" width="20%">nimetus</td>
						<td class="rowValue">
							<xsl:choose>
								<xsl:when test="urn:value/urn:originalText">
									<xsl:value-of select="urn:value/urn:originalText"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="urn:code/urn:originalText"/>
								</xsl:otherwise>
							</xsl:choose>
							<xsl:for-each select="urn:entryRelationship/urn:observation/urn:value/urn:originalText">
								<xsl:value-of select="."/>
								<br/>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:if>
				<!--põhjustaja hammas-->
				<xsl:if test="urn:reasonCode and urn:code/@code='278651003'">
					<tr>
						<td class="rowTitle" width="20%">põhjustaja</td>
						<td class="rowValue">
							<xsl:for-each select="urn:reasonCode">
								<xsl:value-of select="@code"/>
								<br/>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:if>
				<!--aste-->
				<xsl:if test="urn:value/urn:qualifier/urn:value[substring(@codeSystem,1,26)!='1.3.6.1.4.1.28284.6.2.1.13']/@code">
					<tr>
						<td class="rowTitle" width="20%">aste</td>
						<td class="rowValue">
							<xsl:value-of select="urn:value/urn:qualifier/urn:value/@code"/>
							<xsl:if test="urn:value/urn:qualifier/urn:value/@displayName">
								<xsl:text> - </xsl:text>
								<xsl:value-of select="urn:value/urn:qualifier/urn:value/@displayName"/>
							</xsl:if>
						</td>
					</tr>
				</xsl:if>
				<!--juure täidis-->
				<xsl:if test="urn:code/@code='234712004'">
					<tr>
						<td class="rowTitle" width="20%">tüüp</td>
						<td class="rowValue">
							<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
						</td>
					</tr>
					<tr>
						<td class="rowTitle" width="20%">põhjustaja</td>
						<td class="rowValue">
							<xsl:value-of select="urn:reasonCode/@displayName"/>
						</td>
					</tr>
				</xsl:if>
				<!--Molaaride/kaniinide asend-->
			</xsl:if>
			<xsl:if test="urn:code/@code='47944004' or urn:code/@code='12264001'">
				<tr>
					<td class="rowTitle" width="20%">asend</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/@displayName"/>
					</td>
				</tr>
			</xsl:if>
			<!--Mõõt (mm) : sagitaalne ja vertikaalne lahi, diasteem, eelkontaktid, kattumise sügavus-->
			<xsl:if test="urn:code/@code='251292006' or urn:code/@code='24617007' or urn:code/@code='35591002' or urn:code/@code='109797006' or urn:code/@code='23234003'">
				<tr>
					<td class="rowTitle" width="20%">mõõt (mm)</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/@value"/>
					</td>
				</tr>
			</xsl:if>
			<!--Mõõt: Igemetasku sügavus ja igeme taandumine-->
			<xsl:if test="urn:code/@code='286546002' or urn:code/@code='4356008'">
				<tr>
					<td class="rowTitle" width="20%">mõõt</td>
					<td class="rowValue">
						<xsl:call-template name="GingivalTable">
							<xsl:with-param name="siteCode" select="urn:targetSiteCode/@code"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:if>
			<!--Mõõt: Molaaride ja kaniinide-->
			<xsl:if test="urn:code/@code='47944004' or urn:code/@code='12264001'">
				<tr>
					<td class="rowTitle" width="20%">mõõt</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/@value"/>
						<xsl:if test="urn:value/urn:numerator or urn:value/urn:denominator">
							<xsl:value-of select="urn:value/urn:numerator/@value"/>
							<xsl:text>/</xsl:text>
							<xsl:value-of select="urn:value/urn:denominator/@value"/>
						</xsl:if>
					</td>
				</tr>
			</xsl:if>
			<!--Gingiviit-->
			<xsl:if test="urn:code/@code='109628004'">
				<tr>
					<td class="rowTitle" width="20%">gingiviit</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/@displayName"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle" width="20%">diagnoos</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@code"/>
						<xsl:text> - </xsl:text>
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle" width="20%">arsti sõnaline diagnoos</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/urn:originalText"/>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<table>
							<tr class="rowTitle">
								<th>hambavalem</th>
								<th>aste</th>
							</tr>
							<xsl:for-each select="urn:entryRelationship/urn:observation">
								<tr class="rowValue">
									<td class="dataTableCell">
										<xsl:value-of select="urn:targetSiteCode/@code"/>
									</td>
									<td class="dataTableCell">
										<xsl:value-of select="urn:value/@code"/>
									</td>
								</tr>
							</xsl:for-each>
						</table>
					</td>
				</tr>
			</xsl:if>
			<!--Ajutine/jääv-->
			<xsl:if test="urn:interpretationCode">
				<tr>
					<td class="rowTitle" width="20%">tüüp</td>
					<td class="rowValue">
						<xsl:value-of select="urn:interpretationCode/@displayName"/>
					</td>
				</tr>
			</xsl:if>
			<!--Proteesi materjal-->
			<xsl:if test="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial">
				<tr>
					<td class="rowTitle" width="20%">materjal</td>
					<td class="rowValue">
						<xsl:value-of select="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/@displayName"/>
						<xsl:if test="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/urn:originalText">
							<xsl:text> - </xsl:text>
							<xsl:value-of select="urn:entryRelationship/urn:substanceAdministration/urn:consumable/urn:manufacturedProduct/urn:manufacturedMaterial/urn:code/urn:originalText"/>
						</xsl:if>
					</td>
				</tr>
			</xsl:if>
			<!--Kirjeldus-->
			<xsl:if test="urn:text">
				<tr>
					<td class="rowTitle" width="20%">kirjeldus</td>
					<td class="rowValue">
						<xsl:value-of select="urn:text"/>
					</td>
				</tr>
			</xsl:if>
			<!--eelkontakti suund-->
			<xsl:if test="urn:code/@code='109797006'">
				<tr>
					<td class="rowTitle" width="20%">suund</td>
					<td class="rowValue">
						<xsl:value-of select="urn:code/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
			</xsl:if>
			<!--Kaariese ja juure diagnoos-->
			<xsl:if test="urn:code[@code='65413006' or @code='245728004'] and urn:value/urn:qualifier/urn:value">
				<tr>
					<td class="rowTitle">diagnoos</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@code"/>
						<xsl:text> - </xsl:text>
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/@displayName"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">sõnaline diagnoos</td>
					<td class="rowValue">
						<xsl:value-of select="urn:value/urn:qualifier/urn:value/urn:originalText"/>
					</td>
				</tr>
			</xsl:if>
			<!--kruvi pikkus-->
			<xsl:if test="urn:entryRelationship/urn:observation[urn:code/@code='410668003']">
				<tr>
					<td class="rowTitle">kruvi pikkus (mm)</td>
					<td class="rowValue">
						<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='410668003']/urn:value/@value"/>
					</td>
				</tr>
			</xsl:if>
			<!--kruvi diameeter-->
			<xsl:if test="urn:entryRelationship/urn:observation[urn:code/@code='81827009']">
				<tr>
					<td class="rowTitle">kruvi diameeter (mm)</td>
					<td class="rowValue">
						<xsl:value-of select="urn:entryRelationship/urn:observation[urn:code/@code='81827009']/urn:value/@value"/>
					</td>
				</tr>
			</xsl:if>
			<!--Partii ja tootja-->
			<xsl:if test="urn:entryRelationship/urn:supply/urn:product/urn:manufacturedProduct">
				<tr>
					<td class="rowTitle">partii</td>
					<td class="rowValue">
						<xsl:value-of select="urn:entryRelationship/urn:supply/urn:product/urn:manufacturedProduct/urn:manufacturedMaterial/urn:lotNumberText"/>
					</td>
				</tr>
				<tr>
					<td class="rowTitle">tootja</td>
					<td class="rowValue">
						<xsl:value-of select="urn:entryRelationship/urn:supply/urn:product/urn:manufacturedProduct/urn:manufacturerOrganization/urn:name"/>
					</td>
				</tr>
			</xsl:if>
			<!--
			<xsl:if test="urn:author">
				<tr>
					<td class="rowValue" colspan="2">
						<xsl:call-template name="timeCriticalSourceAuthor">
							<xsl:with-param name="tabel" select="'Ei'"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="../../urn:author">
				<tr>
					<td class="rowValue" colspan="2">
						<xsl:apply-templates select="../../." mode="autor">
							<xsl:with-param name="tabel" select="'Ei'"/>
						</xsl:apply-templates>
					</td>
				</tr>
			</xsl:if>-->
		</table>
	</xsl:template>
	<!--

hamba valem ja staatus-->
	<xsl:template name="teethNumberAndStatus">
		<xsl:for-each select="urn:targetSiteCode">
			<xsl:value-of select="@code"/>
			<xsl:if test="not(position()=last())">
				<xsl:text>-</xsl:text>
			</xsl:if>
		</xsl:for-each>
		<xsl:choose>
			<xsl:when test="urn:value/@displayName">
				<xsl:value-of select="urn:value/@displayName"/>
			</xsl:when>
			<xsl:when test="urn:value/@code='278651003'">
				<xsl:text> </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="urn:code/@displayName"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:for-each select="urn:targetSiteCode/urn:qualifier">
			<xsl:choose>
				<xsl:when test="substring(urn:value/@code,1,1)='L'">
					<sup>
						<xsl:value-of select="substring(urn:value/@code,4,1)"/>
					</sup>
				</xsl:when>
				<xsl:otherwise>
					<sup>
						<xsl:value-of select="substring(urn:value/@code,3,1)"/>
					</sup>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Karioloogiline"
	-->
	<xsl:template name="section.teethStatusTableKarioloogiline" match="urn:section" mode="teethStatusTable_K">
		<xsl:param name="showLink"/>
		<xsl:if test="urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']
	or urn:entry/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']">
			<table>
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:text>Karioloogilised staatused: Jäävhambad</xsl:text>
					</td>
				</tr>
				<tr>
					<td colspan="2" width="100%">
						<table width="100%">
							<!--Hambakaar: ülemine : P - proteesid-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Proteesid'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : J - juure staatus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Juur'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Mittekarioosne diagnoos-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Mittekarioosne diagnoos'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : D - kaaries-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'D'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : F - täidis-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'F'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : M - Hamba staatus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'M'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaared-->
							<xsl:call-template name="teethTableRow"/>
							<!--Hambakaar: alumine : M - Hamba staatus-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'M'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : F - täidis-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'F'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : D - kaaries-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'D'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : Mittekarioosne diagnoos-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Mittekarioosne diagnoos'"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : J - juure staatus-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Juur'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : P - proteesid-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Proteesid'"/>
							</xsl:call-template>
						</table>
					</td>
				</tr>
				<!--<tr>
				<td colspan="2" width="100%">
				M - hamba üldine staatus, F - täidis;	D - kaaries, MD - Mittekarioosne diagnoos; J - juure staatus; P - proteesid;
				</td>
			</tr>-->
			</table>
		</xsl:if>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Karioloogiline"
	-->
	<xsl:template name="section.teethStatusTableKarioloogilineChild" match="urn:section" mode="teethStatusTable_K_Child">
		<xsl:param name="showLink"/>
		<xsl:if test="urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='5' or substring(@code,1,1)='6' or substring(@code,1,1)='7' or substring(@code,1,1)='8'
	or substring(@code,1,2)='L5' or substring(@code,1,2)='L6' or substring(@code,1,2)='L7' or substring(@code,1,2)='L8') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']
	or urn:entry/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='5' or substring(@code,1,1)='6' or substring(@code,1,1)='7' or substring(@code,1,1)='8'
	or substring(@code,1,2)='L5' or substring(@code,1,2)='L6' or substring(@code,1,2)='L7' or substring(@code,1,2)='L8') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']">
			<table>
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:text>Karioloogilised staatused: Piimahambad</xsl:text>
					</td>
				</tr>
				<tr>
					<td colspan="2" width="100%">
						<table width="100%">
							<!--Hambakaar: ülemine : P - proteesid-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Proteesid'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : J - juure staatus-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Juur'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Mittekarioosne diagnoos-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Mittekarioosne diagnoos'"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : D - kaaries-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'D'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : F - täidis-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'F'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : M - Hamba staatus-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'M'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaared-->
							<xsl:call-template name="teethTableRowChild"/>
							<!--Hambakaar: alumine : M - Hamba staatus-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'M'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : F - täidis-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'F'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : D - kaaries-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'D'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : Mittekarioosne diagnoos-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Mittekarioosne diagnoos'"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : J - juure staatus-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'Juur'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : P - proteesid-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="showLink2" select="$showLink"/>
								<xsl:with-param name="teethGroup2" select="'Proteesid'"/>
							</xsl:call-template>
						</table>
					</td>
				</tr>
				<!--<tr>
				<td colspan="2" width="100%">
				M - hamba üldine staatus, F - täidis;	D - kaaries, MD - Mittekarioosne diagnoos; J - juure staatus; P - proteesid;
				</td>
			</tr>-->
			</table>
		</xsl:if>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Parodontiline"
	-->
	<xsl:template name="section.teethStatusTableParodontiline" match="urn:section" mode="teethStatusTable_P">
		<xsl:param name="showLink"/>
		<xsl:if test="urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']
	or urn:entry/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']">
			<table>
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:text>Parodontilised staatused: Jäävhambad</xsl:text>
					</td>
				</tr>
				<tr>
					<td colspan="2" width="100%">
						<table width="100%">
							<!--Hambakaar: ülemine : G - Gingiviit-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Gingiviit'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Ladestus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Ladestus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : L - liikuvus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Liikuvus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Igemetasku sügavus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Igemetasku sügavus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Igeme taandumine-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Igeme taandumine'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Furkatsioon-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Furkatsioon'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaared-->
							<xsl:call-template name="teethTableRow"/>
							<!--Hambakaar: alumine : Furkatsioon-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Furkatsioon'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : Igeme taandumine-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Igeme taandumine'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : Igemetasku sügavus-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Igemetasku sügavus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : L - liikuvus-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Liikuvus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine :  Ladestus-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Ladestus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine : G - Gingiviit-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Gingiviit'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
						</table>
					</td>
				</tr>
				<!--<tr>
				<td colspan="2" width="100%">
				G - gingiviit; L - liikuvus
				</td>
			</tr>-->
			</table>
		</xsl:if>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Ortodontiline"
	-->
	<xsl:template name="section.teethStatusTableOrtodontiline" match="urn:section" mode="teethStatusTable_O">
		<xsl:param name="showLink"/>
		<xsl:if test="urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']
	or urn:entry/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='1' or substring(@code,1,1)='2' or substring(@code,1,1)='3' or substring(@code,1,1)='4'
	or substring(@code,1,2)='L1' or substring(@code,1,2)='L2' or substring(@code,1,2)='L3' or substring(@code,1,2)='L4') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']">
			<table>
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:text>Ortodontilised staatused : Jäävhambad</xsl:text>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<table width="100%">
							<!--Hambakaar: ülemine : KÄÄRH - käärhambumus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Käär-ja risthambumus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Diasteem-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Diasteem'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Eelkontakt-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Eelkontakt'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Asendianomaalia'-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Asendianomaalia'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : VL - vertikaalne lahi-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Vertikaalne lahi'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : SL - sagitaalne lahi-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Sagitaalne lahi'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Kattumise sügavus-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Kattumise sügavus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine :A - molaarid ja kaniinid-->
							<xsl:call-template name="TeethStatusTable_Up">
								<xsl:with-param name="teethGroup2" select="'Asend'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaared-->
							<xsl:call-template name="teethTableRow"/>
							<!--Hambakaar: ülemine : Asendianomaalia-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Asendianomaalia'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine :Eelkontakt-->
							<xsl:call-template name="TeethStatusTable_Down">
								<xsl:with-param name="teethGroup2" select="'Eelkontakt'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
						</table>
					</td>
				</tr>
				<!--<tr>
				<td colspan="2">
				KÄÄRH - käärhambumus; RISTH - risthambumus; SL - sagitaalne lahi; VL - vertikaalne lahi; A - molaaride ja kaniinide asend; H - hamba üldine staatus
				</td>
			</tr>-->
			</table>
		</xsl:if>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Ortodontiline"
	-->
	<xsl:template name="section.teethStatusTableOrtodontilineChild" match="urn:section" mode="teethStatusTable_O_Child">
		<xsl:param name="showLink"/>
		<xsl:if test="urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='5' or substring(@code,1,1)='6' or substring(@code,1,1)='7' or substring(@code,1,1)='8'
	or substring(@code,1,2)='L5' or substring(@code,1,2)='L6' or substring(@code,1,2)='L7' or substring(@code,1,2)='L8') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']
	or urn:entry/urn:observation/urn:targetSiteCode[(substring(@code,1,1)='5' or substring(@code,1,1)='6' or substring(@code,1,1)='7' or substring(@code,1,1)='8'
	or substring(@code,1,2)='L5' or substring(@code,1,2)='L6' or substring(@code,1,2)='L7' or substring(@code,1,2)='L8') and substring(@codeSystem,1,26)='1.3.6.1.4.1.28284.6.2.1.92']">
			<table>
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:text>Ortodontilised staatused : Piimahambad</xsl:text>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<table width="100%">
							<!--Hambakaar: ülemine : KÄÄRH - käärhambumus-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Käär-ja risthambumus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Diasteem-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Diasteem'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Eelkontakt-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Eelkontakt'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Asendianomaalia'-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Asendianomaalia'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : VL - vertikaalne lahi-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Vertikaalne lahi'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : SL - sagitaalne lahi-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Sagitaalne lahi'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine : Kattumise sügavus-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Kattumise sügavus'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: ülemine :A - molaarid ja kaniinid-->
							<xsl:call-template name="TeethStatusTable_UpChild">
								<xsl:with-param name="teethGroup2" select="'Asend'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaared-->
							<xsl:call-template name="teethTableRowChild"/>
							<!--Hambakaar: ülemine : Asendianomaalia-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'Asendianomaalia'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
							<!--Hambakaar: alumine :Eelkontakt-->
							<xsl:call-template name="TeethStatusTable_DownChild">
								<xsl:with-param name="teethGroup2" select="'Eelkontakt'"/>
								<xsl:with-param name="showLink2" select="$showLink"/>
							</xsl:call-template>
						</table>
					</td>
				</tr>
				<!--<tr>
				<td colspan="2">
				KÄÄRH - käärhambumus; RISTH - risthambumus; SL - sagitaalne lahi; VL - vertikaalne lahi; A - molaaride ja kaniinide asend; H - hamba üldine staatus
				</td>
			</tr>-->
			</table>
		</xsl:if>
	</xsl:template>
	<!--	
	Template for teethStatusTable "Ortodontiline"
	-->
	<xsl:template name="section.teethStatusDetail" match="urn:section" mode="teethStatusDetail">
		<table>
			<tr>
				<td class="blockLabel" colspan="2">
					<xsl:text>Staatuste detailandmed</xsl:text>
				</td>
			</tr>
			<!--Hamba staatuse (sh liikuvus, ladestused, furkatsioon) Allikas-->
			<xsl:if test="urn:entry/urn:observation[urn:code/@code='43341003']/urn:author">
				<tr>
					<td class="blockLabel" colspan="2">
						<xsl:apply-templates select="urn:entry/urn:observation[urn:code/@code='43341003']" mode="autor">
							<xsl:with-param name="tabel" select="'Ei'"/>
						</xsl:apply-templates>
					</td>
				</tr>
			</xsl:if>
			<!--Hamba staatus (sh liikuvus, ladestused, furkatsioon)-->
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='43341003']/urn:entryRelationship/urn:observation">
				<tr>
					<td class="dataTableCell">
						<a name="{generate-id(urn:code/@code)}">
							<b>
								<xsl:text>Hamba staatus</xsl:text>
							</b>
						</a>
						<br/>
						<xsl:call-template name="hambaStaatus">
							<xsl:with-param name="hambaSt" select="'Jah'"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:for-each>
			<!--molaaride 47944004 ja kaniinide asend, sagitaalne lahi 251292006, kattumise sügavus 23234003, diasteem 35591002, käärhambumus 93154004, 
risthambumus 109495004, gingiviit 109628004-->
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='109628004' or urn:code/@code='47944004'  or urn:code/@code='12264001' or
				urn:code/@code='35591002' or urn:code/@code='93154004' or urn:code/@code='109495004' or urn:code/@code='23234003' or urn:code/@code='251292006' or 
				urn:code/@code='109628004']">
				<tr>
					<td class="dataTableCell">
						<a name="{generate-id(urn:code/@code)}">
							<b>
								<xsl:value-of select="urn:code/@displayName"/>
							</b>
						</a>
						<br/>
						<xsl:call-template name="hambaStaatus"/>
						<xsl:if test="urn:author">
							<xsl:call-template name="timeCriticalSourceAuthor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:call-template>
						</xsl:if>
					</td>
				</tr>
			</xsl:for-each>
			<!--Igemetasku sügavus 286546002, igeme taandumine 4356008, vertikaalne lahi 24617007, anomaaliad 181256000, eelkontaktid 109797006 -->
			<xsl:for-each select="urn:entry/urn:observation[urn:code/@code='286546002' or urn:code/@code='4356008' or 
				urn:code/@code='24617007' or urn:code/@code='181256000' or urn:code/@code='109797006']/urn:entryRelationship/urn:observation">
				<tr>
					<td class="dataTableCell">
						<a name="{generate-id(urn:code/@code)}">
							<b>
								<xsl:value-of select="urn:code/@displayName"/>
							</b>
						</a>
						<br/>
						<xsl:call-template name="hambaStaatus"/>
						<xsl:if test="../../urn:author">
							<xsl:apply-templates select="../../." mode="autor">
								<xsl:with-param name="tabel" select="'Ei'"/>
							</xsl:apply-templates>
						</xsl:if>
					</td>
				</tr>
			</xsl:for-each>
		</table>
	</xsl:template>
	<!--

Template teethTableRow
-->
	<xsl:template name="teethTableRow">
		<tr class="rowTitle">
			<th width="5%"/>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18']">
							L18
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">18</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17']">
							L17
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">17</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16']">
							L16
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">16</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15']">
							L15
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">15</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14']">
							L14
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">14</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13']">
							L13
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">13</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12']">
							L12
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">12</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11']">
							L11
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">11</th>
			<th width="5%">21</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21']">
							L21
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">22</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22']">
							L22
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">23</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23']">
							L23
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">24</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24']">
							L24
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">25</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25']">
							L25
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">26</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26']">
							L26
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">27</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27']">
							L27
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">28</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28']">
							L28
							</xsl:if>
				</th>
			</xsl:if>
		</tr>
		<!--Hambakaar: alumine-->
		<tr class="rowTitle">
			<th/>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L48'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L48']">
							L48
							</xsl:if>
				</th>
			</xsl:if>
			<th>48</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L47'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L47']">
							L47
							</xsl:if>
				</th>
			</xsl:if>
			<th>47</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L46'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L46']">
							L46
							</xsl:if>
				</th>
			</xsl:if>
			<th>46</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L45'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L45']">
							L45
							</xsl:if>
				</th>
			</xsl:if>
			<th>45</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L44'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L44']">
							L44
							</xsl:if>
				</th>
			</xsl:if>
			<th>44</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L43'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L43']">
							L43
							</xsl:if>
				</th>
			</xsl:if>
			<th>43</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L42'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L42']">
							L42
							</xsl:if>
				</th>
			</xsl:if>
			<th>42</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L41'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L41']">
							L41
							</xsl:if>
				</th>
			</xsl:if>
			<th>41</th>
			<th>31</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L31'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L31']">
							L31
							</xsl:if>
				</th>
			</xsl:if>
			<th>32</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L32'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L32']">
							L32
							</xsl:if>
				</th>
			</xsl:if>
			<th>33</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L33'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L33']">
							L33
							</xsl:if>
				</th>
			</xsl:if>
			<th>34</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L34'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L34']">
							L34
							</xsl:if>
				</th>
			</xsl:if>
			<th>35</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L35'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L35']">
							L35
							</xsl:if>
				</th>
			</xsl:if>
			<th>36</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L36'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L36']">
							L36
							</xsl:if>
				</th>
			</xsl:if>
			<th>37</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L37'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L37']">
							L37
							</xsl:if>
				</th>
			</xsl:if>
			<th>38</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L38'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L38']">
							L38
							</xsl:if>
				</th>
			</xsl:if>
		</tr>
	</xsl:template>
	<!--

Template teethTableRowChild
-->
	<xsl:template name="teethTableRowChild">
		<tr class="rowTitle">
			<th width="5%"/>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55' or substring(@code,1,3)='L85'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55' or substring(@code,1,3)='L85']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55']">
							L55
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">55</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54' or substring(@code,1,3)='L84'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54' or substring(@code,1,3)='L84']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54']">
							L54
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">54</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53' or substring(@code,1,3)='L83'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53' or substring(@code,1,3)='L83']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53']">
							L53
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">53</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52' or substring(@code,1,3)='L82'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52' or substring(@code,1,3)='L82']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52']">
							L52
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">52</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51' or substring(@code,1,3)='L81'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51' or substring(@code,1,3)='L81']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51']">
							L51
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">51</th>
			<th width="5%">61</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61' or substring(@code,1,3)='L71'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61' or substring(@code,1,3)='L71']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61']">
							L61
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">62</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62' or substring(@code,1,3)='L72'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62' or substring(@code,1,3)='L72']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62']">
							L62
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">63</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63' or substring(@code,1,3)='L73'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63' or substring(@code,1,3)='L73']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63']">
							L63
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">64</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64' or substring(@code,1,3)='L74'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64' or substring(@code,1,3)='L74']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64']">
							L64
							</xsl:if>
				</th>
			</xsl:if>
			<th width="5%">65</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65' or substring(@code,1,3)='L75'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65' or substring(@code,1,3)='L75']">
				<th width="5%">
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65']">
							L65
							</xsl:if>
				</th>
			</xsl:if>
		</tr>
		<!--Hambakaar: alumine-->
		<tr class="rowTitle">
			<th/>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55' or substring(@code,1,3)='L85'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L55' or substring(@code,1,3)='L85']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L85'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L85']">
							L85
							</xsl:if>
				</th>
			</xsl:if>
			<th>85</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54' or substring(@code,1,3)='L84'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L54' or substring(@code,1,3)='L84']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L84'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L84']">
							L84
							</xsl:if>
				</th>
			</xsl:if>
			<th>84</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53' or substring(@code,1,3)='L83'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L53' or substring(@code,1,3)='L83']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L83'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L83']">
							L83
							</xsl:if>
				</th>
			</xsl:if>
			<th>83</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52' or substring(@code,1,3)='L82'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L52' or substring(@code,1,3)='L82']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L82'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L82']">
							L82
							</xsl:if>
				</th>
			</xsl:if>
			<th>82</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51' or substring(@code,1,3)='L81'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L51' or substring(@code,1,3)='L81']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L81'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L81']">
							L81
							</xsl:if>
				</th>
			</xsl:if>
			<th>81</th>
			<th>71</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61' or substring(@code,1,3)='L71'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L61' or substring(@code,1,3)='L71']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L71'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L71']">
							L71
							</xsl:if>
				</th>
			</xsl:if>
			<th>72</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62' or substring(@code,1,3)='L72'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L62' or substring(@code,1,3)='L72']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L72'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L72']">
							L72
							</xsl:if>
				</th>
			</xsl:if>
			<th>73</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63' or substring(@code,1,3)='L73'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L63' or substring(@code,1,3)='L73']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L73'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L73']">
							L73
							</xsl:if>
				</th>
			</xsl:if>
			<th>74</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64' or substring(@code,1,3)='L74'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L64' or substring(@code,1,3)='L74']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L74'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L74']">
							L74
							</xsl:if>
				</th>
			</xsl:if>
			<th>75</th>
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65' or substring(@code,1,3)='L75'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L65' or substring(@code,1,3)='L75']">
				<th>
					<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L75'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L75']">
							L75
							</xsl:if>
				</th>
			</xsl:if>
		</tr>
	</xsl:template>
	<!--

Template Teet_Status_Table_Up-->
	<!--Hambakaar: ülemine-->
	<xsl:template name="TeethStatusTable_Up">
		<xsl:param name="showLink2"/>
		<xsl:param name="teethGroup2"/>
		<xsl:param name="tableType2"/>
		<tr>
			<th>
				<xsl:value-of select="$teethGroup2"/>
			</th>
			<!--P: L18-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L18'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
							</td>
			</xsl:if>
			<!--P: 18-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'18'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L17-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L17'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P: 17-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'17'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L16-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L16'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P: 16-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'16'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L15-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L15'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:15-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'15'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L14-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L14'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:14-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'14'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L13-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L13'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:13-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'13'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L12-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L12'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:12-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'12'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L11-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L11'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:11-->
			<xsl:choose>
				<xsl:when test="$teethGroup2='Diasteem'">
					<td class="dataTableCell" align="center" colspan="2">
						<xsl:call-template name="TeethStatus_P">
							<xsl:with-param name="siteCode" select="'11'"/>
							<xsl:with-param name="showLink3" select="$showLink2"/>
							<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
							<xsl:with-param name="tableType3" select="$tableType2"/>
						</xsl:call-template>
									&#160;
									</td>
				</xsl:when>
				<xsl:otherwise>
					<td class="dataTableCell" align="center">
						<xsl:call-template name="TeethStatus_P">
							<xsl:with-param name="siteCode" select="'11'"/>
							<xsl:with-param name="showLink3" select="$showLink2"/>
							<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
							<xsl:with-param name="tableType3" select="$tableType2"/>
						</xsl:call-template>
									&#160;
									</td>
					<!--P:21-->
					<td class="dataTableCell" align="center">
						<xsl:call-template name="TeethStatus_P">
							<xsl:with-param name="siteCode" select="'21'"/>
							<xsl:with-param name="showLink3" select="$showLink2"/>
							<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
							<xsl:with-param name="tableType3" select="$tableType2"/>
						</xsl:call-template>
									&#160;
									</td>
				</xsl:otherwise>
			</xsl:choose>
			<!--P:L21-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L21'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:22-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'22'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L22-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L22'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:23-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'23'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L23-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L23'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:24-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'24'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L24-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L24'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:25-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'25'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L25-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L25'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P: 26-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'26'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L26-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L26' or substring(@code,1,3)='L36']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L26'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P: 27-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'27'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L27-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L27' or substring(@code,1,3)='L37']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L27'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P: 28-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'28'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L28-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L28' or substring(@code,1,3)='L38']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L28'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
		</tr>
	</xsl:template>
	<!--

Template Teet_Status_Table_Down-->
	<!--Hambakaar: alumine-->
	<xsl:template name="TeethStatusTable_Down">
		<xsl:param name="showLink2"/>
		<xsl:param name="teethGroup2"/>
		<xsl:param name="tableType2"/>
		<tr>
			<th>
				<xsl:value-of select="$teethGroup2"/>
			</th>
			<!--P: L48-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L18' or substring(@code,1,3)='L48']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L48'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
							</td>
			</xsl:if>
			<!--P: 48-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'48'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L47-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L17' or substring(@code,1,3)='L47']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L47'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P: 47-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'47'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L46-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L16' or substring(@code,1,3)='L46']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L46'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P: 46-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'46'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P: L45-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L15' or substring(@code,1,3)='L45']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L45'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:45-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'45'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L44-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L14' or substring(@code,1,3)='L44'] ">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L44'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:44-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'44'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L43-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L13' or substring(@code,1,3)='L43']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L43'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:43-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'43'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L42-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L12' or substring(@code,1,3)='L42']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L42'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:42-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'42'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L41-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L11' or substring(@code,1,3)='L41']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L41'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:41-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'41'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:31-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'31'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L31-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L21' or substring(@code,1,3)='L31']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L31'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:32-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'32'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L32-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L22' or substring(@code,1,3)='L32']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L32'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:33-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'33'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L33-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L23' or substring(@code,1,3)='L33']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L33'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
							&#160;
									</td>
			</xsl:if>
			<!--P:34-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'34'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L34-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L24' or substring(@code,1,3)='L34']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-param name="siteCode" select="'L34'"/>
						<xsl:with-param name="showLink3" select="$showLink2"/>
						<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
						<xsl:with-param name="tableType3" select="$tableType2"/>
					</xsl:call-template>
								&#160;
									</td>
			</xsl:if>
			<!--P:35-->
			<td class="dataTableCell" align="center">
				<xsl:call-template name="TeethStatus_P">
					<xsl:with-param name="siteCode" select="'35'"/>
					<xsl:with-param name="showLink3" select="$showLink2"/>
					<xsl:with-param name="teethGroup3" select="$teethGroup2"/>
					<xsl:with-param name="tableType3" select="$tableType2"/>
				</xsl:call-template>
									&#160;
									</td>
			<!--P:L35-->
			<xsl:if test="urn:entry/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35'] or 
								urn:entry/urn:observation/urn:entryRelationship/urn:observation/urn:targetSiteCode[substring(@code,1,3)='L25' or substring(@code,1,3)='L35']">
				<td class="dataTableCell" align="center">
					<xsl:call-template name="TeethStatus_P">
						<xsl:with-
