<?xml version="1.0" encoding="UTF-8"?>
<!--

Stylesheet for teeth status templates
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:urn="urn:hl7-org:v3" xmlns:ext="urn:hl7-EE-DL-Ext:v1">
	<!--

	Main epicrisis template which includes content rows
	-->
	<xsl:template name="structuredBody.teethStatus" match="urn:structuredBody" mode="teethStatus">
		<!-- patsient-->
		<xsl:if test="../../urn:recordTarget">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:recordTarget" mode="epicrises"/>
				</td>
			</tr>
		</xsl:if>
		<!-- muu osaleja /eestkostja-->
		<xsl:if test="../../urn:recordTarget/urn:patientRole/urn:patient/urn:guardian">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:recordTarget/urn:patientRole/urn:patient" mode="guardian"/>
				</td>
			</tr>
		</xsl:if>
		<!--Indeksid-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='43341003']/urn:entry/urn:observation/urn:code[@code='251309006' or @code='251314005' or @code='364126007' or @code='249420004']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethIndex"/>
				</td>
			</tr>
		</xsl:if>
	<xsl:if test="urn:component/urn:section[urn:code/@code='43341003']">
		<!--Karioloogiline tabel: Piimahambad-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusTable_K_Child">
					<xsl:with-param name="showLink" select="'Jah'"/>
					</xsl:apply-templates>
				</td>
			</tr>
			<!--Ortodontiline tabel: Piimahambad-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusTable_O_Child">
					<xsl:with-param name="showLink" select="'Jah'"/>
					</xsl:apply-templates>
				</td>
			</tr>
		<!--Karioloogiline tabel-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusTable_K">
					<xsl:with-param name="showLink" select="'Jah'"/>
					</xsl:apply-templates>
				</td>
			</tr>
		<!--Parodontiline tabel: Jäävhambad-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusTable_P">
					<xsl:with-param name="showLink" select="'Jah'"/>
					</xsl:apply-templates>
				</td>
			</tr>
		<!--Ortodontiline tabel: Jäävhambad-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusTable_O">
					<xsl:with-param name="showLink" select="'Jah'"/>
					</xsl:apply-templates>
				</td>
			</tr>
			<!--Ortodontiline aparaat-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="orthodonticRetainer"/>
				</td>
			</tr>
		<!--Staatuste detailandmed : Jäävhambad-->
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='43341003']" mode="teethStatusDetail">
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

