<?xml version="1.0" encoding="UTF-8"?>
<!--

Stylesheet for epicrisis 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.dentalAnalysis" match="urn:structuredBody" mode="dentalAnalysis">
		<!-- 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>
		<!-- suunaja-->
		<xsl:if test="../../urn:componentOf/urn:encompassingEncounter/urn:encounterParticipant[@typeCode='REF']/urn:assignedEntity">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:componentOf/urn:encompassingEncounter/urn:encounterParticipant[@typeCode='REF']/urn:assignedEntity" mode="refattender"/>
				</td>
			</tr>
		</xsl:if>
		<!-- saatekiri/tellimus-->
		<xsl:if test="../../urn:inFulfillmentOf/urn:order">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:inFulfillmentOf/urn:order" mode="reference"/>
				</td>
			</tr>
		</xsl:if>
		<!-- ravijuhtum-->
		<xsl:if test="../../urn:componentOf/urn:encompassingEncounter">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:componentOf/urn:encompassingEncounter" mode="careEncounter"/>
				</td>
			</tr>
		</xsl:if>
		<!--Analüüs-->
		<tr>
			<td class="tableBlock">
				<!-- call template for procedures, surgery and tests -->
				<xsl:call-template name="procedures"/>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>

