<xsl:stylesheet xmlns:n1="urn:hl7-org:v3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" id="urn:sist:stylesheet:cda:1.0" exclude-result-prefixes="xsl n1 xsi" xmlns:in="urn:lantana-com:inline-variable-data">
	<xsl:output encoding="UTF-8" indent="yes" method="html" omit-xml-declaration="yes" standalone="yes"/>
	<!-- VARIABILI GLOBALI -->
	<xsl:variable name="tableWidth">50%</xsl:variable>
	<xsl:variable name="codeDocument" select="/n1:ClinicalDocument/n1:code/@code"/>
	<xsl:variable name="codeRegione" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/>
	<xsl:variable name="tipoCDA" select="/n1:ClinicalDocument/n1:templateId/@extension"/>
	<xsl:variable name="setIdExtension" select="/n1:ClinicalDocument/n1:setId/@extension"/>
	<xsl:variable name="qualifierTipoAss" select="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@codeSystem='2.16.840.1.113883.2.9.6.1.47']/@code"/>
	<xsl:variable name="qualifierTipoPrescrizione" select="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@codeSystem='2.16.840.1.113883.2.9.6.1.46']/@code"/>
	<xsl:variable name="flagErogazione" select="false()"/>
	<!--
		This file is based on 
		Title: CDA XSL StyleSheet
  		Original Filename: cda.xsl 
  		Version: 3.0
		Copyright 2016 Lantana Consulting Group

		Released under Apache License, Version 2.0

		Licensed under the Apache License, Version 2.0 (the "License");
		you may not use this file except in compliance with the License.
		You may obtain a copy of the License at

		    http://www.apache.org/licenses/LICENSE-2.0

		Unless required by applicable law or agreed to in writing, software
		distributed under the License is distributed on an "AS IS" BASIS,
		WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
		See the License for the specific language governing permissions and
		limitations under the License.
	-->	
	<xsl:variable name="limit-external-images" select="'yes'"/>
	<!-- A vertical bar separated list of URI prefixes, such as "http://www.example.com|https://www.example.com" -->
	<xsl:variable name="external-image-whitelist"/>
	<xsl:variable name="logo-location" select="string('data:image/png;base64,[encoded data, 6044 characters]')"/>
	<!-- string processing variables -->
	<xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
	<xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
	<!-- removes the following characters, in addition to line breaks "':;?`{}“”„‚’ -->
	<xsl:variable name="simple-sanitizer-match">
	<xsl:text>&#10;&#13;&#34;&#39;&#58;&#59;&#63;&#96;&#123;&#125;&#8220;&#8221;&#8222;&#8218;&#8217;</xsl:text>
	</xsl:variable>
	<xsl:variable name="simple-sanitizer-replace" select="'***************'"/>
	<xsl:variable name="javascript-injection-warning">WARNING: Javascript injection attempt detected
	in source CDA document. Terminating</xsl:variable>
	<xsl:variable name="malicious-content-warning">WARNING: Potentially malicious content found in CDA
	document.</xsl:variable>
	<!-- global variable title -->
	<xsl:variable name="title">
	<xsl:choose>
	  <xsl:when test="string-length(/n1:ClinicalDocument/n1:title) >= 1">
	    <xsl:value-of select="/n1:ClinicalDocument/n1:title"/>
	  </xsl:when>
	  <xsl:when test="/n1:ClinicalDocument/n1:code/@displayName">
	    <xsl:value-of select="/n1:ClinicalDocument/n1:code/@displayName"/>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:text>Clinical Document</xsl:text>
	  </xsl:otherwise>
	</xsl:choose>
	</xsl:variable>
	<!-- ROOT -->
	<xsl:template match="/">		
		<xsl:apply-templates select="n1:ClinicalDocument"/>
	</xsl:template>
	<!-- END ROOT -->
	<!-- ClinicalDocument -->
	<xsl:template match="n1:ClinicalDocument">		
		<xsl:choose>
			<!-- TEMPLATE TIPO DOC CERT INPS 28653-4 or INAIL 28578-3-->
			<xsl:when test="$codeDocument='28653-4' or $codeDocument='28578-3'">
			<html>
      			<head>
					<style>table, .datatable{border:2px solid black;width: 90%;cellpadding:3;font-family: "Verdana", Arial, sans-serif;font-size: 9pt;line-height: 1.2em;}
					div, div.xmlBody{margin: 2px;padding: 2px;box-sizing: border-box;}
					th, td {width:50%;text-align: left;padding: 3px;}
					table th {font-size: 14px;}
					.titleCertificato{border: 0 none;}
					.riepilogosupboldCVP {font-weight: bold; color: #000; line-height: 1.2em; font-size: 12px; }
					.intestazioneCERT{font-size:16px;}
					.riepilogosupCVP{border-color: #000;font-size: 12px;}
					.datatable{border-color: #000;}
					.titoloCERT{font-size: 18px;}
					
					</style>
				</head>
				<body>
				<div id="intestazioneCertificato">
					<table class="titleCertificato">
						<tr>
							<th align="left" class="titoloCERT">
								<xsl:call-template name="titolo"/>
							</th>
							<th align="left" width="30%"/>
						</tr>
						<tr>
							<th align="left">Data Rilascio:</th>
							<td width="30%">
								<xsl:call-template name="formatTimestamp">
									<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/>
								</xsl:call-template>
							</td>
						</tr>
						<xsl:if test="$codeDocument='28653-4'">
							<tr>
								<th align="left">Numero protocollo:</th>
								<td width="30%">
									<xsl:value-of select="$setIdExtension"/>
								</td>
							</tr>
						</xsl:if>
					</table>
				</div>
				<xsl:variable name="nullFlavorID" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@nullFlavor"/>
				<xsl:choose>
					<xsl:when test="$nullFlavorID = 'NA'"/>
					<xsl:otherwise>
						<div>
							<table>
								<tr>
									<th colspan="2" align="left">Dati relativi al paziente</th>
								</tr>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name)">
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Assistito: </xsl:text>
											</span>
										</td>
										<td>
											<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
											<xsl:choose>
												<xsl:when test="$nullFlavor='MSK'">
													<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
													</xsl:call-template>
												</xsl:otherwise>
											</xsl:choose>
										</td>
									</tr>
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Codice Fiscale: </xsl:text>
											</span>
										</td>
										<td>
											<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001')">
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20'])">
										<tr>
											<td>
												<xsl:text>Numero Tesserino SASN: </xsl:text>
											</td>
											<td colspan="3">
												<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20']/@extension"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON'])">
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Società di Navigazione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON']/n1:scopingOrganization/n1:name"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[n1:associatedEntity[@classCode='GUAR']]/n1:time)">
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Data Scadenza Tessera TEAM: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:if>
								</xsl:if>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Indirizzo: </xsl:text>
											</span>
										</td>
										<td>
											<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/@nullFlavor"/>
											<xsl:choose>
												<xsl:when test="$nullFlavor='MSK'">
													<xsl:text/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:call-template name="getContactInfo">
														<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole"/>
													</xsl:call-template>
												</xsl:otherwise>
											</xsl:choose>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime">
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Data di nascita: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
											</xsl:call-template>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace">
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Luogo di nascita: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<xsl:call-template name="getContactInfo">
												<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place"/>
											</xsl:call-template>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode)">
									<tr>
										<td align="left">
											<span class="riepilogosupboldCVP">
												<xsl:text>Sesso: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<xsl:variable name="sex" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/>
											<xsl:choose>
												<xsl:when test="$sex='M'">MASCHIO</xsl:when>
												<xsl:when test="$sex='F'">FEMMINA</xsl:when>
												<xsl:otherwise>
													<xsl:variable name="sex2" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@displayName"/>
													<xsl:choose>
														<xsl:when test="$sex2='M'">MASCHIO</xsl:when>
														<xsl:when test="$sex2='F'">FEMMINA</xsl:when>
														<xsl:otherwise>DATO NON DISPONIBILE</xsl:otherwise>
													</xsl:choose>
												</xsl:otherwise>
											</xsl:choose>
										</td>
									</tr>
									<!-- nuova riga paziente-->
								</xsl:if>
								<xsl:choose>
									<xsl:when test="contains('34133-9.34878-9', $codeDocument)">
										<xsl:variable name="nullFlavorUNK" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@nullFlavor"/>
										<xsl:choose>
											<xsl:when test="$nullFlavorUNK='UNK'"/>
											<xsl:otherwise>
												<tr>
													<th align="left" colspan="4">
														<xsl:text>Tutore legale dell'assistito: </xsl:text>
													</th>
												</tr>
												<tr>
													<td colspan="2">
														<span class="riepilogosupCVP">
															<xsl:call-template name="getName">
																<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
															</xsl:call-template>
															<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																<br/>
																<xsl:call-template name="getContactInfo">
																	<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																</xsl:call-template>
															</xsl:for-each>
														</span>
													</td>
													<th style="text-align: right; width:25%">
														<xsl:text>Codice Fiscale: </xsl:text>
													</th>
													<td>
														<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@extension"/>
													</td>
												</tr>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
								</xsl:choose>
							</table>
						</div>
						<xsl:choose>
							<xsl:when test="contains('28653-4', $codeDocument)">
								<xsl:variable name="nullGuardian" select="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/.)"/>
								<xsl:choose>
									<xsl:when test="$nullGuardian=true"/>
									<xsl:otherwise>
										<div>
											<span class="intestazioneCERT">Reperibilità durante la malattia</span>
											<table>
												<!--tr>
												<th scope="row" colspan="4" class="">Reperibilità durante la malattia</th>
											</tr-->
												<tr>
													<td>
														<span class="riepilogosupboldCVP">
															<xsl:text>Nominativo indicato presso l'abitazione: </xsl:text>
														</span>
													</td>
													<td>
														<span class="riepilogosupCVP">
															<xsl:call-template name="getName">
																<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
															</xsl:call-template>
														</span>
													</td>
												</tr>
												<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
													<tr>
														<td>
															<span class="riepilogosupboldCVP">
																<xsl:text>Indirizzo: </xsl:text>
															</span>
														</td>
														<td>
															<span class="riepilogosupCVP">
																<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																	<xsl:call-template name="getContactInfo">
																		<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																	</xsl:call-template>
																</xsl:for-each>
															</span>
														</td>
													</tr>
												</xsl:if>
											</table>
										</div>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
						</xsl:choose>
						<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']) and not($tipoCDA = 'ITPRF_SDO_001')">
							<xsl:variable name="existAslPaziente">
								<xsl:choose>
									<xsl:when test="contains('29304-3', $codeDocument)">
										<xsl:choose>
											<xsl:when test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity/n1:scopingOrganization/n1:id)">
												<xsl:value-of select="'SI'"/>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="'NO'"/>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="'SI'"/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<xsl:if test="$existAslPaziente = 'SI'">
								<table>
									<thead>
										<tr>
											<th scope="row" colspan="2" class="intestazionetabella">
												<xsl:choose>
													<xsl:when test="contains('34878-9.34133-9', $codeDocument)">
														<xsl:text>Dati relativi ad contatti di parenti riferiti al paziente</xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:text>Dati relativi alla ASL di competenza del paziente</xsl:text>
													</xsl:otherwise>
												</xsl:choose>
											</th>
										</tr>
									</thead>
									<tbody>
										<xsl:call-template name="contactTarget"/>
									</tbody>
								</table>
							</xsl:if>
						</xsl:if>
					</xsl:otherwise>
				</xsl:choose>
				<!-- parte relativa all'autore -->
				<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC'])">
					<table>
						<thead>
							<tr>
								<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
								sostituito</th>
							</tr>
						</thead>
						<tbody>
							<xsl:call-template name="subsituteDoctor"/>
						</tbody>
					</table>
				</xsl:if>
				<xsl:if test="boolean(/n1:ClinicalDocument/n1:informant)">
					<table>
						<thead>
							<tr>
								<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
								suggeritore</th>
							</tr>
						</thead>
						<tbody>
							<xsl:call-template name="supportDoctor"/>
						</tbody>
					</table>
				</xsl:if>
				<xsl:for-each select="/n1:ClinicalDocument/n1:componentOf">
					<table>
						<thead>
							<tr>
								<th scope="row" colspan="4" class="intestazionetabella">Dati relativi iter
								strutturale della richiesta</th>
							</tr>
						</thead>
						<tbody>
							<xsl:if test="$codeDocument='47039-3'">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Data accettazione ricovero: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="$tipoCDA='ITPRF_SDO_001'">
								<xsl:variable name="repartoDimissione" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:id/@extension"/>
								<xsl:variable name="repartoAmmissione" select="../n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
								<xsl:variable name="codRiscontroAutoptico" select="n1:encompassingEncounter/n1:code/@code"/>
								<xsl:variable name="codRegime" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:code/@codeSystem"/>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Data accettazione ricovero: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDateGGMMYYYY">
												<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:entry[1]/n1:encounter/n1:effectiveTime/n1:low/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>U.O. di accettazione: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosupCVP">
											<xsl:text>Specialita' clinica: </xsl:text>
											<xsl:value-of select="substring($repartoAmmissione,1,2)"/>
											<xsl:text> - Prog. reparto: </xsl:text>
											<xsl:value-of select="substring($repartoAmmissione,3,2)"/>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Data dimissione ricovero: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDateGGMMYYYY">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>U.O. di dimissione: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosupCVP">
											<xsl:text>Specialita' clinica: </xsl:text>
											<xsl:value-of select="substring($repartoDimissione,1,2)"/>
											<xsl:text> - Prog. reparto: </xsl:text>
											<xsl:value-of select="substring($repartoDimissione,3,2)"/>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Numero Ricovero: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 1,2)"/>
											<xsl:text> - </xsl:text>
											<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 3,6)"/>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Regime ricovero: </xsl:text>
										</span>
									</td>
									<!-- <xsl:choose> <xsl:when test="substring($codRegime,string-length($codRegime))='1'"> 
									<td> <span class="riepilogosup">ORDINARIO</span> </td> </xsl:when> <xsl:when 
									test="substring($codRegime,string-length($codRegime))='2'"> <td> <span class="riepilogosup">DAY-HOSPITAL</span> 
									</td> </xsl:when> <xsl:otherwise> <td> <span class="riepilogosup">DATO NON 
									DISPONIBILE</span> </td> </xsl:otherwise> </xsl:choose> -->
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:choose>
												<xsl:when test="substring($codRegime,string-length($codRegime))='1'">
													<xsl:text>ORDINARIO</xsl:text>
												</xsl:when>
												<xsl:when test="substring($codRegime,string-length($codRegime))='2'">
													<xsl:text>DAY-HOSPITAL</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Modalita' dimissione: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosupCVP">
											<xsl:value-of select="n1:encompassingEncounter/n1:dischargeDispositionCode/@displayName"/>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Riscontro autoptico: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:choose>
												<xsl:when test="$codRiscontroAutoptico='1'">
													<xsl:text>SI</xsl:text>
												</xsl:when>
												<xsl:when test="$codRiscontroAutoptico='2'">
													<xsl:text>NO</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:title"/>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosupCVP">
											<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:text"/>
										</span>
									</td>
								</tr>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = '']/n1:title"/>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosupCVP">
											<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'DIAGNOSI']/n1:text"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="contains('18748-4.11502-2', $codeDocument)">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Data esecuzione prestazione: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="$codeDocument='22034-3'">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Codice nosologico: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:value-of select="n1:encompassingEncounter/n1:realmCode/@code"/>
										</span>
									</td>
								</tr>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Tipologia esame</xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="translateCode">
												<xsl:with-param name="code" select="n1:encompassingEncounter/n1:code/@code"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Data prelievo esame: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:low/@value"/>
											</xsl:call-template>
										</span>
									</td>
									<td style="text-align='right'; width:10%">
										<span class="riepilogosupbold">
											<xsl:text>Data esaminazione esame: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:high/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="$codeDocument='28568-4'">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Data accettazione: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Struttura sanitaria</xsl:text>
											<br/>
											<xsl:text>(codifica ministeriale)</xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="getConcatID">
												<xsl:with-param name="root" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@root"/>
												<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
							<xsl:if test="boolean(n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code)">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Disciplina (reparto)</xsl:text>
											<br/>
											<xsl:text>codifica Ministero della Salute: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="getConcatID">
												<xsl:with-param name="root" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@codeSystem"/>
												<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@code"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:if>
						</tbody>
					</table>
					<!--FINE TABELLA -->
				</xsl:for-each>
				<xsl:for-each select="/n1:ClinicalDocument/n1:documentationOf">
					<table>
						<xsl:choose>
							<xsl:when test="contains('18748-4.11502-2.22034-3.28568-4', $codeDocument) or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001' )">
								<thead>
									<tr>
										<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al dettaglio
										sulla prestazione eseguita</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Codice Fiscale</xsl:text>
												<br/>
												<xsl:text>(Catalogo Prestazioni Italia): </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:value-of select="n1:serviceEvent/n1:code/@code"/>
												<!-- <xsl:call-template name="getConcatID"> <xsl:with-param name="root" 
												select="n1:serviceEvent/n1:code/@codeSystem"/> <xsl:with-param name="extension" 
												select="n1:serviceEvent/n1:code/@code"/> </xsl:call-template> -->
											</span>
										</td>
									</tr>
									<xsl:if test="not(n1:serviceEvent/n1:code/@displayName ='')">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Descrizione della prestazione: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="n1:serviceEvent/n1:code/@displayName"/>
												</span>
											</td>
										</tr>
									</xsl:if>
								</tbody>
							</xsl:when>
							<xsl:when test="$tipoCDA = 'ITPRF_[REFERTO PS]-001' ">
								<thead>
									<tr>
										<th scope="row" colspan="2" class="intestazionetabella">Dati relativi all'episodio
										di emergenza</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Numero caso:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:value-of select="substring-before(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
												<xsl:text> - </xsl:text>
												<xsl:value-of select="substring('000000',string-length(substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.'))+1)"/>
												<xsl:value-of select="substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
											</span>
										</td>
									</tr>
								</tbody>
							</xsl:when>
							<xsl:otherwise>
								<xsl:if test="contains('34878-9.34133-9', $codeDocument)">
									<thead>
										<tr>
											<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al periodo
											di riferimento del documento di Patient Summary</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Inizio periodo</xsl:text>
													<br/>
													<xsl:text>raccolta dati clinici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:choose>
														<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
															<xsl:text>DATO NON DISPONIBILE</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="formatDate">
																<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:low/@value"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Fine periodo</xsl:text>
													<br/>
													<xsl:text>raccolta dati clinici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:choose>
														<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
															<xsl:text>DATO NON DISPONIBILE</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="formatDate">
																<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:high/@value"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td>
										</tr>
									</tbody>
								</xsl:if>
							</xsl:otherwise>
						</xsl:choose>
					</table>
				</xsl:for-each>
				<xsl:choose>
					<xsl:when test="($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001')">
						<table>
							<thead>
								<tr>
									<th class="intestazionetabella" colspan="2" scope="row">
										<xsl:text>Dati del referto</xsl:text>
									</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Categoria:</xsl:text>
										</span>
									</td>
									<td>
										<xsl:variable name="categoria" select="/n1:ClinicalDocument/n1:relatedDocument/@typeCode"/>
										<xsl:choose>
											<xsl:when test="$categoria='RPLC'">
												<span class="riepilogosup">
													<xsl:text>SOSTITUTIVO</xsl:text>
												</span>
											</xsl:when>
											<xsl:when test="$categoria='APND'">
												<span class="riepilogosup">
													<xsl:text>AGGIUNTIVO</xsl:text>
												</span>
											</xsl:when>
											<xsl:otherwise>
												<span class="riepilogosup">
													<xsl:text>NATIVO</xsl:text>
												</span>
											</xsl:otherwise>
										</xsl:choose>
									</td>
								</tr>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='UPDATE NOTE'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Nota nuovo referto:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='UPDATE NOTE']/n1:text"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='ASSESSMENT'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Descrizione:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ASSESSMENT']/n1:text"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='CONCLUSIONS'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Conclusioni:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='CONCLUSIONS']/n1:text"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='PHYSICIAN REPORT ATTACHMENT'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Allegato del corpo:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ATTACHMENT']">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Allegato del referto:</xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:value-of select="./n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
												<xsl:text> - </xsl:text>
												<xsl:value-of select="./n1:text"/>
											</span>
										</td>
									</tr>
								</xsl:for-each>
							</tbody>
						</table>
					</xsl:when>
					<xsl:otherwise>
						<div>
							<xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
						</div>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:call-template name="bottomline"/>
				<!--/xsl:if-->
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC CERT INPS 28653-4 o INAIL 28578-3 -->
			<!-- TEMPLATE TIPO DOC EROGATO SPECIALISTICO 34109-9  -->
			<xsl:when test="$codeDocument='34109-9'">
			<html>
      			<head>
				<style>table, .datatable{border:2px solid black;width: 90%;cellpadding:3;font-family: "Verdana", Arial, sans-serif;font-size: 9pt;line-height: 1.2em;margin-bottom:5px;}
					th, td { width:50%;text-align: left;padding: 3px;}table th {font-size: 14px;}
					.titleErogSpec{border: 0 none;}
					.riepilogosupboldCVP {font-weight: bold; color: #000; line-height: 1.2em; font-size: 12px; }
					.intestazioneCERT{font-size:16px;}
					.riepilogosupCVP{border-color: #000;font-size: 12px;}
					.datatable{border-color: #000;}
					.titolo{font-size: 18px;}
					.intestazionetabella,.riepilogosupbold{color:#000;background-color:#FFF;font-weight:bold;}					
					</style>
				</head>
				<body>
					<div id="intestazioneErogSpec">
						<table class="titleErogSpec">
							<tr>
								<th align="left" class="titolo">
									<xsl:call-template name="titolo"/>
								</th>
								<th align="left" width="30%"/>
							</tr>
							<tr>
								<th align="left">Data Rilascio:</th>
								<td width="30%">
									<xsl:call-template name="formatTimestamp">
										<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/>
									</xsl:call-template>
								</td>
							</tr>
							
							
							
							

							<xsl:variable name="idDocumentoErogazioneSpec" select="/n1:ClinicalDocument/n1:id/@extension" />
							<xsl:if test="string-length($idDocumentoErogazioneSpec)>=15">
								<tr>
									<th align="left">NRE:</th>
									<td width="30%">
										<xsl:value-of select="substring($idDocumentoErogazioneSpec,1,15)"/>
									</td>
								</tr>
							</xsl:if>
							
						</table>
					</div>
					<xsl:variable name="nullFlavorID" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@nullFlavor"/>
					<xsl:choose>
						<xsl:when test="$nullFlavorID = 'NA'"/>
						<xsl:otherwise>
							<div>
								<table>
									<tr>
										<th colspan="2" align="left">Dati relativi al paziente</th>
									</tr>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name)">
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Assistito: </xsl:text>
												</span>
											</td>
											<td>
												<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
												<xsl:choose>
													<xsl:when test="$nullFlavor='MSK'">
														<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:call-template name="getName">
															<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
														</xsl:call-template>
													</xsl:otherwise>
												</xsl:choose>
											</td>
										</tr>
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Codice Fiscale: </xsl:text>
												</span>
											</td>
											<td>
												<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001')">
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20'])">
											<tr>
												<td>
													<xsl:text>Numero Tesserino SASN: </xsl:text>
												</td>
												<td colspan="3">
													<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20']/@extension"/>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON'])">
											<tr>
												<td>
													<span class="riepilogosupbold">
														<xsl:text>Società di Navigazione: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosup">
														<xsl:value-of select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON']/n1:scopingOrganization/n1:name"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[n1:associatedEntity[@classCode='GUAR']]/n1:time)">
											<tr>
												<td>
													<span class="riepilogosupbold">
														<xsl:text>Data Scadenza Tessera TEAM: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosup">
														<xsl:call-template name="formatDate">
															<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value"/>
														</xsl:call-template>
													</span>
												</td>
											</tr>
										</xsl:if>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Indirizzo: </xsl:text>
												</span>
											</td>
											<td>
												<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/@nullFlavor"/>
												<xsl:choose>
													<xsl:when test="$nullFlavor='MSK'">
														<xsl:text/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:call-template name="getContactInfo">
															<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole"/>
														</xsl:call-template>
													</xsl:otherwise>
												</xsl:choose>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime">
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Data di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
												</xsl:call-template>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace">
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Luogo di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<xsl:call-template name="getContactInfo">
													<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place"/>
												</xsl:call-template>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode)">
										<tr>
											<td align="left">
												<span class="riepilogosupboldCVP">
													<xsl:text>Sesso: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<xsl:variable name="sex" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/>
												<xsl:choose>
													<xsl:when test="$sex='M'">MASCHIO</xsl:when>
													<xsl:when test="$sex='F'">FEMMINA</xsl:when>
													<xsl:otherwise>
														<xsl:variable name="sex2" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@displayName"/>
														<xsl:choose>
															<xsl:when test="$sex2='M'">MASCHIO</xsl:when>
															<xsl:when test="$sex2='F'">FEMMINA</xsl:when>
															<xsl:otherwise>DATO NON DISPONIBILE</xsl:otherwise>
														</xsl:choose>
													</xsl:otherwise>
												</xsl:choose>
											</td>
										</tr>
										<!-- nuova riga paziente-->
									</xsl:if>
									<xsl:choose>
										<xsl:when test="contains('34133-9.34878-9', $codeDocument)">
											<xsl:variable name="nullFlavorUNK" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@nullFlavor"/>
											<xsl:choose>
												<xsl:when test="$nullFlavorUNK='UNK'"/>
												<xsl:otherwise>
													<tr>
														<th align="left" colspan="4">
															<xsl:text>Tutore legale dell'assistito: </xsl:text>
														</th>
													</tr>
													<tr>
														<td colspan="2">
															<span class="riepilogosupCVP">
																<xsl:call-template name="getName">
																	<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																</xsl:call-template>
																<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																	<br/>
																	<xsl:call-template name="getContactInfo">
																		<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																	</xsl:call-template>
																</xsl:for-each>
															</span>
														</td>
														<th style="text-align: right; width:25%">
															<xsl:text>Codice Fiscale: </xsl:text>
														</th>
														<td>
															<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@extension"/>
														</td>
													</tr>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
									</xsl:choose>
								</table>
							</div>
							<xsl:choose>
								<xsl:when test="contains('28653-4', $codeDocument)">
									<xsl:variable name="nullGuardian" select="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/.)"/>
									<xsl:choose>
										<xsl:when test="$nullGuardian=true"/>
										<xsl:otherwise>
											<div>
												<span class="intestazioneCERT">Reperibilità durante la malattia</span>
												<table>
													<tr>
														<td>
															<span class="riepilogosupboldCVP">
																<xsl:text>Nominativo indicato presso l'abitazione: </xsl:text>
															</span>
														</td>
														<td>
															<span class="riepilogosupCVP">
																<xsl:call-template name="getName">
																	<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																</xsl:call-template>
															</span>
														</td>
													</tr>
													<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
														<tr>
															<td>
																<span class="riepilogosupboldCVP">
																	<xsl:text>Indirizzo: </xsl:text>
																</span>
															</td>
															<td>
																<span class="riepilogosupCVP">
																	<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																		<xsl:call-template name="getContactInfo">
																			<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																		</xsl:call-template>
																	</xsl:for-each>
																</span>
															</td>
														</tr>
													</xsl:if>
												</table>
											</div>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
							</xsl:choose>
							<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']) and not($tipoCDA = 'ITPRF_SDO_001')">
								<xsl:variable name="existAslPaziente">
									<xsl:choose>
										<xsl:when test="contains('29304-3', $codeDocument)">
											<xsl:choose>
												<xsl:when test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity/n1:scopingOrganization/n1:id)">
													<xsl:value-of select="'SI'"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="'NO'"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="'SI'"/>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:if test="$existAslPaziente = 'SI'">
									<div>
										<table>
											<thead>
												<tr>
													<th scope="row" colspan="2" class="">
														<xsl:choose>
															<xsl:when test="contains('34878-9.34133-9', $codeDocument)">
																<xsl:text>Dati relativi ad contatti di parenti riferiti al paziente</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:text>Dati relativi alla ASL di competenza del paziente</xsl:text>
															</xsl:otherwise>
														</xsl:choose>
													</th>
												</tr>
											</thead>
											<tbody>
												<xsl:for-each select="/n1:ClinicalDocument/n1:participant[@typeCode='IND']">
													<xsl:variable name="telecomContact">
														<xsl:call-template name="getContactInfo">
															<xsl:with-param name="contact" select="n1:associatedEntity"/>
														</xsl:call-template>
													</xsl:variable>
													<xsl:choose>
														<xsl:when test="n1:associatedEntity[@classCode='GUAR']">
															<tr>
																<td style="">
																	<span class="">
																		<xsl:text>Codice Identificativo: </xsl:text>
																	</span>
																</td>
																<td>
																	<span class="riepilogosup">
																		<xsl:call-template name="ASL_AO_EE_Decode">
																			<xsl:with-param name="codice" select="n1:associatedEntity/n1:scopingOrganization/n1:id/@extension"/>
																		</xsl:call-template>
																	</span>
																</td>
															</tr>
														</xsl:when>
														<xsl:otherwise>
															<xsl:for-each select="n1:associatedEntity[@classCode='NOK']">
																<tr>
																	<td colspan="2">
																		<span class="riepilogosupbold">
																			<xsl:call-template name="translateCode">
																				<xsl:with-param name="code" select="n1:code/@code"/>
																			</xsl:call-template>
																		</span>
																	</td>
																</tr>
																<tr>
																	<td style="width:20%">
																		<span class="riepilogosupbold">
																			<xsl:text>Codice Identificativo: </xsl:text>
																		</span>
																	</td>
																	<td>
																		<span class="riepilogosup">
																			<xsl:value-of select="n1:id/@extension"/>
																		</span>
																	</td>
																</tr>
																<xsl:if test="boolean(n1:associatedPerson)">
																	<tr>
																		<td style="width:20%">
																			<span class="riepilogosupbold">
																				<xsl:text>Dati anagrafici: </xsl:text>
																			</span>
																		</td>
																		<td>
																			<span class="riepilogosupCVP">
																				<xsl:call-template name="getName">
																					<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
																				</xsl:call-template>
																				<xsl:if test="not($telecomContact = '')">
																					<br/>
																					<xsl:value-of select="$telecomContact"/>
																				</xsl:if>
																			</span>
																		</td>
																	</tr>
																</xsl:if>
															</xsl:for-each>
															<xsl:for-each select="n1:associatedEntity[@classCode='ECON']">
																<tr>
																	<td colspan="2">
																		<span class="riepilogosupbold">
																			<xsl:text>Contatto per emergenza</xsl:text>
																		</span>
																	</td>
																</tr>
																<tr>
																	<td style="width:20%">
																		<span class="riepilogosupbold">
																			<xsl:text>Codice Identificativo: </xsl:text>
																		</span>
																	</td>
																	<td>
																		<span class="riepilogosup">
																			<xsl:value-of select="n1:id/@extension"/>
																		</span>
																	</td>
																</tr>
																<xsl:if test="boolean(n1:associatedPerson)">
																	<tr>
																		<td style="width:20%">
																			<span class="riepilogosupbold">
																				<xsl:text>Dati anagrafici: </xsl:text>
																			</span>
																		</td>
																		<td>
																			<span class="riepilogosupCVP">
																				<xsl:call-template name="getName">
																					<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
																				</xsl:call-template>
																				<xsl:if test="not($telecomContact = '')">
																					<br/>
																					<xsl:value-of select="$telecomContact"/>
																				</xsl:if>
																			</span>
																		</td>
																	</tr>
																</xsl:if>
															</xsl:for-each>
															<xsl:for-each select="n1:associatedEntity[@classCode='CAREGIVER']">
																<tr>
																	<td colspan="2">
																		<span class="riepilogosupbold">
																			<xsl:text>Contatto per assistenza</xsl:text>
																		</span>
																	</td>
																</tr>
																<tr>
																	<td style="width:20%">
																		<span class="riepilogosupbold">
																			<xsl:text>Codice Identificativo: </xsl:text>
																		</span>
																	</td>
																	<td>
																		<span class="riepilogosup">
																			<xsl:value-of select="n1:id/@extension"/>
																		</span>
																	</td>
																</tr>
																<xsl:if test="boolean(n1:associatedPerson)">
																	<tr>
																		<td style="width:20%">
																			<span class="riepilogosupbold">
																				<xsl:text>Dati anagrafici: </xsl:text>
																			</span>
																		</td>
																		<td>
																			<span class="riepilogosupCVP">
																				<xsl:call-template name="getName">
																					<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
																				</xsl:call-template>
																				<xsl:if test="not($telecomContact = '')">
																					<br/>
																					<xsl:value-of select="$telecomContact"/>
																				</xsl:if>
																			</span>
																		</td>
																	</tr>
																</xsl:if>
															</xsl:for-each>
														</xsl:otherwise>
													</xsl:choose>
												</xsl:for-each>
											</tbody>
										</table>
									</div>
								</xsl:if>
							</xsl:if>
						</xsl:otherwise>
					</xsl:choose>
					<div>
						<!-- Esenzione -->
						<table>
							<thead>
								<tr>
									<th class="" scope="row">Esenzione (Codifica Regionale)</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>
										<xsl:variable name="esenzione">
											<xsl:choose>
												<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)">
													<xsl:choose>
														<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text != 'RICETTA NON ESENTE'">
															<xsl:choose>
																<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code)">
																	<xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code/@code, ' - ', /n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)"/>
																</xsl:when>
																<xsl:otherwise>
																	<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text"/>
																</xsl:otherwise>
															</xsl:choose>
														</xsl:when>
														<xsl:otherwise>
															<xsl:value-of select="'RICETTA NON ESENTE'"/>
														</xsl:otherwise>
													</xsl:choose>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="'RICETTA NON ESENTE'"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:variable>
										<xsl:value-of select="$esenzione"/>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div>
						<!-- PRESTAZIONI -->
						<div id="intestazioneErogSpec">
							<table class="titleErogSpec">
								<tr>
									<th align="left" class="titolo">
									Prestazioni erogate
								</th>
								</tr>
								<tr>
									<div>
										<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='EROGAZIONE_SPECIALISTICA']/n1:text/n1:list[@ID = 'EROG']/n1:item">
											<xsl:variable name="indice" select="position()"/>
											<xsl:variable name="tipoErogazione" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID]"/>
											<!-- SEZIONE SPECIALISTICA -->
											<table class="datatable" cellspacing="0" cellpadding="3">
												<thead>
													<tr scope="row" colspan="2" class="intestazionetabella">
														<!-- CODICE -->
														<td style="width:20%">
															<span class="intestazionetabella">Codice Nomenclatore:</span>
														</td>
														<td>
															<span class="intestazionetabella">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:code/@code"/>
															</span>
														</td>
														<td style="width:20%">
															<span class="riepilogosupbold"/>
														</td>
														<td>
															<span class="riepilogosup"/>
														</td>
													</tr>
													<tr scope="row" colspan="2" class="intestazionetabella">
														<!-- CODICE -->
														<td style="width:20%">
															<span class="intestazionetabella">Codice Catalogo:</span>
														</td>
														<td>
															<span class="intestazionetabella">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:code/n1:qualifier/n1:value[@codeSystem='2.16.840.1.113883.2.9.2.160.6.12']/@code"/>
															</span>
														</td>
														<td style="width:20%">
															<span class="riepilogosupbold"/>
														</td>
														<td>
															<span class="riepilogosup"/>
														</td>
													</tr>	
												</thead>
												<tbody>
													<tr>
														<!-- DESCRIZIONE -->
														<td style="width:20%">
															<span class="riepilogosupbold">Descrizione:</span>
														</td>
														<td>
															<span class="riepilogosupCVP">
																<xsl:value-of select="n1:content"/>
															</span>
														</td>
														<!-- PREZZO RIMBORSO -->
														<td style="width:20%">
															<span class="riepilogosupbold">Prezzo Rimborso:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS']/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.4']]/n1:value/@value"/>
															</span>
														</td>
													</tr>
													<tr>
														<!-- QUANTITA -->
														<td style="width:20%">
															<span class="riepilogosupbold">Quantita:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:supply/n1:quantity/@value"/>
															</span>
														</td>
														<!-- SCONTO SSN -->
														<td style="width:20%">
															<span class="riepilogosupbold">Sconto SSN:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS']/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.5']]/n1:value/@value"/>
															</span>
														</td>
													</tr>
													<tr>
														<!-- DATA INIZIO EROGAZIONE -->
														<td style="width:20%">
															<span class="riepilogosupbold">Data Inizio Erogazione:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:call-template name="formatDate">
																	<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:effectiveTime/n1:low/@value"/>
																</xsl:call-template>
															</span>
														</td>
														<!-- COD. REPARTO -->
														<td style="width:20%">
															<span class="riepilogosupbold">Cod. Reparto:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id[@root='2.16.840.1.113883.2.9.4.1.6']/@extension"/>
															</span>
														</td>
													</tr>
													<tr>
														<!-- DATA FINE EROGAZIONE -->
														<td style="width:20%">
															<span class="riepilogosupbold">Data Fine Erogazione:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:call-template name="formatDate">
																	<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:effectiveTime/n1:high/@value"/>
																</xsl:call-template>
															</span>
														</td>													
														<!-- COD. PRESIDIO -->
														<td style="width:20%">
															<span class="riepilogosupbold">Cod. Presidio:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:performer/n1:assignedEntity/n1:representedOrganization[n1:id[@root='2.16.840.1.113883.2.9.4.1.6']]/n1:asOrganizationPartOf/n1:id[@root='2.16.840.1.113883.2.9.4.1.2']/@extension"/>
															</span>
														</td>
													</tr>
													<tr>
													<td style="width:20%">
															<span class="riepilogosupbold">Data Prenotazione: </span>
														</td>
													<td>											
														<xsl:variable name="dataPrenotazione" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode='SAS']/n1:encounter[@moodCode='APT']/n1:effectiveTime/@value" />
														<span class="riepilogosup">
															<xsl:call-template name="formatDate">
																<xsl:with-param name="date"
																select="$dataPrenotazione" />
															</xsl:call-template>
														</span>
													</td>
													<!-- GARANZIA TEMPI MASSIMI -->
													<td style="width:20%">
														<span class="riepilogosupbold">Garanzia Tempi Massimi: </span>
													</td>
													<td>
														<span class="riepilogosup">
														<xsl:variable name="garanziaTempiMassimi" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode='SAS']/n1:encounter[@moodCode='APT']/n1:priorityCode/@code" />
														<xsl:variable name="garanziaTempiMassimiValore">
															<xsl:choose>
																<xsl:when test="$garanziaTempiMassimi = '16874'">
																	 <xsl:value-of select="'SI'"/>
																</xsl:when>
																<xsl:when test="$garanziaTempiMassimi = '16869'">
																	 <xsl:value-of select="'NO'"/>
																</xsl:when>	 
																<xsl:otherwise>
																	 <xsl:value-of select="' '"/>
																</xsl:otherwise>
															</xsl:choose>
														</xsl:variable>
														<xsl:value-of select="$garanziaTempiMassimiValore" />										
														</span>
													</td>
													</tr>
													<tr>
														<!-- PREZZO -->
														<td style="width:20%">
															<span class="riepilogosupbold">Prezzo:</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.3']]/n1:value/@value"/>
															</span>
														</td>
														
														<!-- TELEVISITA  -->
														<xsl:if test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode = 'SAS']/n1:encounter[@classCode = 'ENC'][@moodCode = 'INT']/n1:text)">
															<xsl:variable name="codTelevisita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode = 'SAS']/n1:encounter[@classCode = 'ENC'][@moodCode = 'INT']/n1:text" />
															<xsl:variable name="codTelevisitaValore">
																<xsl:choose>
																	<xsl:when test="$codTelevisita = 'V=T;'">
																		 <xsl:value-of select="'SI'"/>
																	</xsl:when>
																	<xsl:when test="$codTelevisita = 'V=A;'">
																		 <xsl:value-of select="'NO'"/>
																	</xsl:when>	 
																	<xsl:otherwise>
																		 <xsl:value-of select="' '"/>
																	</xsl:otherwise>
																</xsl:choose>
															</xsl:variable>	
																<!-- TELEVISITA CODIFICATA SI/NO -->
																<td style="width:20%">
																	<span class="riepilogosupbold">Televisita: </span>
																</td>
																<td>
																	<span class="riepilogosupCVP">
																		<xsl:value-of select="$codTelevisitaValore" />
																	</span>
																</td>
														</xsl:if>
													
													</tr>																			
							
												</tbody>
											</table>
										</xsl:for-each>
									</div>
								</tr>
							</table>
						</div>
						<!-- END PRESTAZIONI -->
						<div>
							<xsl:call-template name="bottomline"/>
						</div>
					</div>
					<!-- Esenzione -->
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC EROGATO SPECIALISTICO 34109-9 -->
			<!-- TEMPLATE REFERTO 	11502-2 --> 			
			<xsl:when test="$codeDocument = '11502-2' or $codeDocument = '11488-4'">
			<html>
				<head>
				<xsl:call-template name="bootstrap-css"/>
				
					<style type="text/css">/* ============= STILI PER LE TABELLE =================================*/
				body{
				 border: 5px solid black;
				 padding:10px;
				 }
				 
				 .titleLetteraDimissioni {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 1.5em;
					text-align: left;
					line-height: 1em;	
				}
				
				table{
					border: none;
					width: 100%;
				}
				td{
					width: 20%;
				}
				.datatable {
					border: solid;
					border-color: #000 ;
					width: 100%;
					border-width: thin;
				}
                
				.datatable_right {
					text-align:right;
					width: 100%;
					
				}

				.tab:link {
					text-decoration : none;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #000000;
					font-weight : normal;
					text-align: left;
				}

				.tab:visited {
					text-decoration : none;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #CC3366;
					font-weight : normal;
					text-align: left;
				}	

				.tab:hover {
					text-decoration : underline;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #CC0000;
					font-weight : normal;
					text-align: left;
					background-color: #FFB6C1;
				}

				.intestazionetabella {
					color : #000;
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
					background-color : #FFFFFF;
					text-align: left;
				}
		
		
				.intestazionetabellaright {
					color : #FFFFFF;
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
					background-color : #009BCC;
					text-align: right;
				}
		
				.rigapari {
					background-color : #CCE5FF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: left;
				}

				.rigadispari {
					background-color : #FFFFFF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: left;
				}

				.rigapariright {
					background-color : #CCE5FF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: right;
				}

				.rigadispariright {
					background-color : #FFFFFF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: right;
				}

				/* STILI PER IL TESTO */
				h1 
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color :#000;
				text-align : left;
				font-size: 1.3em;
				}
				
				h2 
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color :#000;
				text-align : left;
				font-size: 1.3em;
				}
 
				h3
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-size: 1.2em;
				}
 
				h4
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-size: 1.1em;
				}
               
               	h4.titolotabella
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-weight : normal;
				font-size: 1.1em;
				margin-bottom:5px;
				} 

				 h4.titolotabella2
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : right;
				font-weight : normal;
				font-size: 1.1em;
				margin-bottom:5px;
				} 

				h5.sinistra
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #003366;
				text-align : left;
				font-size: 1em;
				border-width: 1px;
				border-style: solid;
				border-color: #336699;
				padding: 3px;
				margin-top: -10px;
				margin-left: 15px;
				width: auto;
				background-color: #FFF;
				position: absolute;
				/*z-index: auto;*/
				}
 
				h5.destra
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #003366;
				text-align : right;
				font-size: 1em;
				border-width: 1px;
				border-style: solid;
				border-color: #336699;
				padding: 3px;
				margin-top: -10px;
				margin-left: 15px;
				width: auto;
				background-color: #FFF;
				position: absolute;
				/*z-index: auto;*/
				}
 
				div#inforiepilogo{
					line-height: 1em; 
	
				}
				.riepilogosupbold {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em;
					white-space: pre; 
				}
				.riepilogosupbold_right{
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: right;
					line-height: 1em;
					white-space: pre; 
				}
				.riepilogosupboldCVP {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em;	
				}

				.riepilogosup {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em; 
					white-space: pre; 
				}
				.riepilogosupCVP {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-size: 0.9em;
					text-align: justify;
					line-height: 1em; 
				}

				.titolosezione {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					caption-side: top;	
					text-align: left;
				}

				.bold{
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
				}
 
				.normalright {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : normal;
					text-align: right;
				}

				.normalcenter {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : normal;
					text-align: center;
				}

				.alignright {
					text-align: right;
				}

				.white {
					color : #FFFFFF;
				}
	
				#nodisplay {
					display : none;
				}

				p {
					line-height: 1.2em;
				}
				
				.titolostrutturaReferto{ margin: 0;padding:0; }
				.indirizzo_titolostrutturaReferto{ font-size: 16px; margin: 0;padding:0;}				
				.regione_titolostrutturaReferto{margin: 0;padding:0;font-size: 16px;}
				.documento_titolostrutturaReferto{margin: 10px 0 0 0;padding:0; }
				
				<!--Adeguamento Differenze xsl portale Evolutiva FSE 2.0 - 27/10/2022 -->
				.info-bottom,
				.header,
				.container-fluid,
				.col-md-8,
				.section-title,
				.header-group-content
				{ margin: 3px;padding:2; }

				
				</style>
				<!--script>
				    // gnigni
					/*function visualizzaAllegatoPdf()
					{
					
						var pdfViewer = document.getElementById('pdfViewer');
						
						var visualizzaAllegatoPdf = document.getElementById('visualizzaAllegatoPdf');
						visualizzaAllegatoPdf.appendChild(pdfViewer);
						
					
						//var element = document.getElementById('visualizzaAllegatoPdf');
						//element.style.visibility = 'visible';
						//element.style.block = 'block';
						//alert('k');
					}
					
					function nascondiAllegatoPdf()
					{
						var pdfViewer = document.getElementById('pdfViewer');
						var visualizzaAllegatoPdfNascosto=document.getElementById('visualizzaAllegatoPdfNascosto');
						visualizzaAllegatoPdfNascosto.appendChild(pdfViewer);
						
					}
					
					function visualizzaAllegatoPdfNuovaPagina(base64EncodedPDF)
					{
					    alert(base64EncodedPDF);
						window.open("data:application/pdf;base64, " + base64EncodedPDF);	
					}*/
				
				</script-->
				</head>
				<body>
				<div>
				<table cellpadding="6">
					<tr>
						<td rowspan="6">
							<img id="image_logo_regione" alt="" src=""><xsl:attribute name="src"><xsl:value-of select="$logo-location"/></xsl:attribute></img>
						</td>
					</tr>
				</table>
				
				
					
					<h2 class="titolostrutturaReferto">
						<xsl:call-template name="regione"/>
					</h2>
					
					<xsl:call-template name="titolostrutturaReferto"/>
					
					<h3 class="titleLetteraDimissioni">
						<xsl:call-template name="titolo"/>
					</h3>
					
					<xsl:variable name="nullFlavorID" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@nullFlavor"/>
					<xsl:choose>
						<xsl:when test="$nullFlavorID = 'NA'"/>
						<xsl:otherwise>
							<h4 class="titolotabella">Paziente</h4>
							<table class="datatable2" cellpadding="3" cellspacing="0" width="90%">
								<tbody>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name)">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Assistito: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
													<xsl:choose>
														<xsl:when test="$nullFlavor='MSK'">
															<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="getName">
																<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<tr>
										<td style="width:10%">
											<span class="riepilogosupbold">
												<xsl:text>Codice Fiscale: </xsl:text>
											</span>
										</td>
										<td colspan="2">
											<span class="riepilogosup">
												<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
											</span>
										</td><td></td>
									</tr>
									<xsl:if test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001')">
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20'])">
											<tr>
												<td style="width:10%">
													<span class="riepilogosupbold">
														<xsl:text>Numero Tesserino SASN: </xsl:text>
													</span>
												</td>
												<td colspan="2">
													<span class="riepilogosup">
														<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20']/@extension"/>
													</span>
												</td><td></td>
											</tr>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON'])">
											<tr>
												<td style="width:10%">
													<span class="riepilogosupbold">
														<xsl:text>Società di Navigazione: </xsl:text>
													</span>
												</td>
												<td colspan="2">
													<span class="riepilogosup">
														<xsl:value-of select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON']/n1:scopingOrganization/n1:name"/>
													</span>
												</td><td></td>
											</tr>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[n1:associatedEntity[@classCode='GUAR']]/n1:time)">
											<tr>
												<td style="width:10%">
													<span class="riepilogosupbold">
														<xsl:text>Data Scadenza Tessera TEAM: </xsl:text>
													</span>
												</td>
												<td colspan="2">
													<span class="riepilogosup">
														<xsl:call-template name="formatDate">
															<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value"/>
														</xsl:call-template>
													</span>
												</td><td></td>
											</tr>
										</xsl:if>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Indirizzo: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/@nullFlavor"/>
													<xsl:choose>
														<xsl:when test="$nullFlavor='MSK'">
															<xsl:text/>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="getContactInfo">
																<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Data di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
													</xsl:call-template>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Luogo di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:call-template name="getContactInfo">
														<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place"/>
													</xsl:call-template>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode)">
										<tr>
											<td style="width: 10%">
												<span class="riepilogosupbold">
													<xsl:text>Sesso: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="sex" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/>
													<xsl:choose>
														<xsl:when test="$sex='M'">MASCHIO</xsl:when>
														<xsl:when test="$sex='F'">FEMMINA</xsl:when>
														<xsl:otherwise>
															<xsl:variable name="sex2" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@displayName"/>
															<xsl:choose>
																<xsl:when test="$sex2='M'">MASCHIO</xsl:when>
																<xsl:when test="$sex2='F'">FEMMINA</xsl:when>
																<xsl:otherwise>DATO NON DISPONIBILE</xsl:otherwise>
															</xsl:choose>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
										<!-- nuova riga paziente-->
									</xsl:if>
									<xsl:choose>
										<xsl:when test="contains('34133-9.34878-9', $codeDocument)">
											<xsl:variable name="nullFlavorUNK" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@nullFlavor"/>
											<xsl:choose>
												<xsl:when test="$nullFlavorUNK='UNK'"/>
												<xsl:otherwise>
													<tr>
														<td colspan="4">
															<span class="riepilogosupbold">
																<xsl:text>Tutore legale dell'assistito: </xsl:text>
															</span>
														</td>
													</tr>
													<tr>
														<td colspan="2">
															<span class="riepilogosupCVP">
																<xsl:call-template name="getName">
																	<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																</xsl:call-template>
																<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																	<br/>
																	<xsl:call-template name="getContactInfo">
																		<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																	</xsl:call-template>
																</xsl:for-each>
															</span>
														</td>
														<td style="text-align: right; width:25%">
															<span class="riepilogosupbold">
																<xsl:text>Codice identificativo: </xsl:text>
															</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@extension"/>
															</span>
														</td>
													</tr>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
									</xsl:choose>
								</tbody>
							</table>
							<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']) and not($tipoCDA = 'ITPRF_SDO_001')">
								<xsl:variable name="existAslPaziente">
									<xsl:choose>
										<xsl:when test="contains('29304-3', $codeDocument)">
											<xsl:choose>
												<xsl:when test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity/n1:scopingOrganization/n1:id)">
													<xsl:value-of select="'SI'"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="'NO'"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="'SI'"/>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:if test="$existAslPaziente = 'SI'">
									<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
										<thead>
											<tr>
												<th scope="row" colspan="2" class="intestazionetabella">
													<xsl:choose>
														<xsl:when test="contains('34878-9.34133-9', $codeDocument)">
															<xsl:text>Dati relativi ad contatti di parenti riferiti al paziente</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:text>Dati relativi alla ASL di competenza del paziente</xsl:text>
														</xsl:otherwise>
													</xsl:choose>
												</th>
											</tr>
										</thead>
										<tbody>
											<xsl:call-template name="contactTarget"/>
										</tbody>
									</table>
								</xsl:if>
							</xsl:if>
						</xsl:otherwise>
					</xsl:choose>
					<br/><br/>
					<!-- parte relativa all'autore -->
					<!--h4 class="titolotabella2">Autore del documento</h4>
					<table class="datatable_right" cellpadding="3" cellspacing="0" width="90%">						
						<tbody>
							<xsl:for-each select="/n1:ClinicalDocument/n1:author">
								<tr>
									<td>
										<span class="riepilogosupbold_right">
											<xsl:text>Codice Fiscale: </xsl:text>
										</span>
										<span class="riepilogosup">
											<xsl:value-of select="n1:assignedAuthor/n1:id/@extension"/>
										</span>
									</td>
								</tr>
								<xsl:choose>
									<xsl:when test="boolean(n1:assignedAuthor/n1:assignedPerson/n1:name)">
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Dati Anagrafici: </xsl:text>
												</span>
												<span class="riepilogosupCVP">
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="n1:assignedAuthor/n1:assignedPerson/n1:name"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:when>
								</xsl:choose>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id[@root='2.16.840.1.113883.2.9.2.160.4.2.1'] and $flagErogazione=true)">
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Codice Regionale Farmacia: </xsl:text>
											</span>
											<span class="riepilogosup">
												<xsl:value-of select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id/@extension"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Data di produzione del documento: </xsl:text>
										</span>
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:time/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:for-each>
						</tbody>
					</table-->
					<br/><br/>
					<h4 class="titolotabella">Struttura responsabile della conservazione della registrazione originale </h4>
					<table class="datatable2" cellpadding="3" cellspacing="0" width="90%">
						<tbody>
							<tr>
								<td style="width:10%">
									<span class="riepilogosupbold">
										<xsl:text>Codice identificativo: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/>
									</span>
								</td><td></td>
							</tr>
							<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name) or (($tipoCDA = 'ITPRF_SDO_001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or $tipoCDA = ('ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001'))">
								<tr>
									<td style="width:10%">
										<span class="riepilogosupbold">
											<xsl:text>Struttura sanitaria</xsl:text>
											<br/>
											<xsl:text>(ASL/AO, Studio medico, ecc.): </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosupCVP">
											<xsl:choose>
												<xsl:when test="($tipoCDA = 'ITPRF_SDO_001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001') ">
													<!--CDA DELLA SDO O CDA REF. SPECIALISTICO OR PS OR RICOVERO -->
													<xsl:value-of select="/n1:ClinicalDocument/n1:id/@assigningAuthorityName"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
													<br/>
													<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr)">
														<xsl:call-template name="getContactInfo">
															<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
														</xsl:call-template>
													</xsl:if>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td><td></td>
								</tr>
							</xsl:if>
						</tbody>
					</table>
					<br/><br/>
					<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC'])">
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
								sostituito</th>
								</tr>
							</thead>
							<tbody>
								<xsl:call-template name="subsituteDoctor"/>
							</tbody>
						</table>
					</xsl:if>
					<xsl:if test="boolean(/n1:ClinicalDocument/n1:informant)">
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
								suggeritore</th>
								</tr>
							</thead>
							<tbody>
								<xsl:call-template name="supportDoctor"/>
							</tbody>
						</table>
					</xsl:if>
					<xsl:for-each select="/n1:ClinicalDocument/n1:componentOf">
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="4" class="intestazionetabella">Dati relativi iter
								strutturale della richiesta</th>
								</tr>
							</thead>
							<tbody>
								<xsl:if test="$codeDocument='47039-3'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Data accettazione ricovero: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
												</xsl:call-template>></span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="$tipoCDA='ITPRF_SDO_001'">
									<xsl:variable name="repartoDimissione" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:id/@extension"/>
									<xsl:variable name="repartoAmmissione" select="../n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
									<xsl:variable name="codRiscontroAutoptico" select="n1:encompassingEncounter/n1:code/@code"/>
									<xsl:variable name="codRegime" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:code/@codeSystem"/>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Data accettazione ricovero: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="formatDateGGMMYYYY">
													<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:entry[1]/n1:encounter/n1:effectiveTime/n1:low/@value"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>U.O. di accettazione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:text>Specialita' clinica: </xsl:text>
												<xsl:value-of select="substring($repartoAmmissione,1,2)"/>
												<xsl:text> - Prog. reparto: </xsl:text>
												<xsl:value-of select="substring($repartoAmmissione,3,2)"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Data dimissione ricovero: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="formatDateGGMMYYYY">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>U.O. di dimissione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:text>Specialita' clinica: </xsl:text>
												<xsl:value-of select="substring($repartoDimissione,1,2)"/>
												<xsl:text> - Prog. reparto: </xsl:text>
												<xsl:value-of select="substring($repartoDimissione,3,2)"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Numero Ricovero: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 1,2)"/>
												<xsl:text> - </xsl:text>
												<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 3,6)"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Regime ricovero: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:choose>
													<xsl:when test="substring($codRegime,string-length($codRegime))='1'">
														<xsl:text>ORDINARIO</xsl:text>
													</xsl:when>
													<xsl:when test="substring($codRegime,string-length($codRegime))='2'">
														<xsl:text>DAY-HOSPITAL</xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:text>DATO NON DISPONIBILE</xsl:text>
													</xsl:otherwise>
												</xsl:choose>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Modalita' dimissione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:value-of select="n1:encompassingEncounter/n1:dischargeDispositionCode/@displayName"/>
											</span>
										</td>
									</tr>
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Riscontro autoptico: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:choose>
													<xsl:when test="$codRiscontroAutoptico='1'">
														<xsl:text>SI</xsl:text>
													</xsl:when>
													<xsl:when test="$codRiscontroAutoptico='2'">
														<xsl:text>NO</xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:text>DATO NON DISPONIBILE</xsl:text>
													</xsl:otherwise>
												</xsl:choose>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:title"/>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:text"/>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">


												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'DIAGNOSI']/n1:title"/>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'DIAGNOSI']/n1:text"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="contains('18748-4.11502-2', $codeDocument)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Data esecuzione prestazione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									
									<xsl:if test="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:code/@displayName">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Provenienza: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:value-of select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:code/@displayName"/>												
												</span>
											</td>
										</tr>
									</xsl:if>

								</xsl:if>
								<xsl:if test="$codeDocument='22034-3'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Codice nosologico: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:value-of select="n1:encompassingEncounter/n1:realmCode/@code"/>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Tipologia esame</xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="translateCode">
													<xsl:with-param name="code" select="n1:encompassingEncounter/n1:code/@code"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Data prelievo esame: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:low/@value"/>
												</xsl:call-template>
											</span>
										</td>
										<td style="text-align='right'; width:10%">
											<span class="riepilogosupbold">
												<xsl:text>Data esaminazione esame: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:high/@value"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="$codeDocument='28568-4'">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Data accettazione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Struttura sanitaria</xsl:text>
												<br/>
												<xsl:text>(codifica ministeriale)</xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="getConcatID">
													<xsl:with-param name="root" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@root"/>
													<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:if>
								<xsl:if test="boolean(n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Disciplina (reparto)</xsl:text>
												<br/>
												<xsl:text>codifica Ministero della Salute: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:call-template name="getConcatID">
													<xsl:with-param name="root" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@codeSystem"/>
													<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@code"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:if>
							</tbody>
						</table>
						<!--FINE TABELLA -->
					</xsl:for-each>
					<xsl:for-each select="/n1:ClinicalDocument/n1:documentationOf">
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<xsl:choose>
								<xsl:when test="contains('18748-4.11502-2.22034-3.28568-4', $codeDocument) or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001' )">
									<thead>
										<tr>
											<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al dettaglio
										sulla prestazione eseguita</th>
										</tr>
									</thead>
									<tbody>
										<!--<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Codice identificativo</xsl:text>
													<br/>
													<xsl:text>(Catalogo Prestazioni Italia): </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="n1:serviceEvent/n1:code/@code"/>													
												</span>
											</td>
										</tr>-->
										<xsl:if test="not(n1:serviceEvent/n1:code/@displayName ='')">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Stato del referto: </xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:value-of select="n1:serviceEvent/n1:code/@displayName"/>
													</span>
												</td>
											</tr>
										</xsl:if>
									</tbody>
								</xsl:when>
								<xsl:when test="$tipoCDA = 'ITPRF_[REFERTO PS]-001' ">
									<thead>
										<tr>
											<th scope="row" colspan="2" class="intestazionetabella">Dati relativi all'episodio
										di emergenza</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Numero caso:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="substring-before(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="substring('000000',string-length(substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.'))+1)"/>
													<xsl:value-of select="substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
												</span>
											</td>
										</tr>
									</tbody>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="contains('34878-9.34133-9', $codeDocument)">
										<thead>
											<tr>
												<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al periodo
											di riferimento del documento di Patient Summary</th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Inizio periodo</xsl:text>
														<br/>
														<xsl:text>raccolta dati clinici: </xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:choose>
															<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
																<xsl:text>DATO NON DISPONIBILE</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:call-template name="formatDate">
																	<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:low/@value"/>
																</xsl:call-template>
															</xsl:otherwise>
														</xsl:choose>
													</span>
												</td>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Fine periodo</xsl:text>
														<br/>
														<xsl:text>raccolta dati clinici: </xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:choose>
															<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
																<xsl:text>DATO NON DISPONIBILE</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:call-template name="formatDate">
																	<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:high/@value"/>
																</xsl:call-template>
															</xsl:otherwise>
														</xsl:choose>
													</span>
												</td>
											</tr>
										</tbody>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</table>
					</xsl:for-each>
					<!--
					<xsl:choose>
						<xsl:when test="($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001')">
							<table class="datatable" width="90%" summary="dati del referto" cellpadding="3" cellspacing="0">
								<thead>
									<tr>
										<th class="intestazionetabella" colspan="2" scope="row">
											<xsl:text>Dati del referto</xsl:text>
										</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Categoria:</xsl:text>
											</span>
										</td>
										<td>
											<xsl:variable name="categoria" select="/n1:ClinicalDocument/n1:relatedDocument/@typeCode"/>
											<xsl:choose>
												<xsl:when test="$categoria='RPLC'">
													<span class="riepilogosup">
														<xsl:text>SOSTITUTIVO</xsl:text>
													</span>
												</xsl:when>
												<xsl:when test="$categoria='APND'">
													<span class="riepilogosup">
														<xsl:text>AGGIUNTIVO</xsl:text>
													</span>
												</xsl:when>
												<xsl:otherwise>
													<span class="riepilogosup">
														<xsl:text>NATIVO</xsl:text>
													</span>
												</xsl:otherwise>
											</xsl:choose>
										</td>
									</tr>
									<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='UPDATE NOTE'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Nota nuovo referto:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='UPDATE NOTE']/n1:text"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='ASSESSMENT'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Descrizione:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ASSESSMENT']/n1:text"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='CONCLUSIONS'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Conclusioni:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='CONCLUSIONS']/n1:text"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='PHYSICIAN REPORT ATTACHMENT'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Allegato del corpo:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ATTACHMENT']">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Allegato del referto:</xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="./n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="./n1:text"/>
												</span>
											</td>
										</tr>
									</xsl:for-each>
								</tbody>
							</table>
						</xsl:when>
						<xsl:otherwise>
							<xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
						</xsl:otherwise>
					</xsl:choose>-->
					
					
					<xsl:apply-templates select="n1:component/n1:structuredBody"/>
					
					
				</div>
				<xsl:call-template name="bottomline"/>
				
				<!--Adeguamento Differenze xsl portale Evolutiva FSE 2.0 - 27/10/2022 -->
				<div class="info-bottom">
					<xsl:call-template name="componentOf"/>
					<xsl:call-template name="informationRecipient"/>
					<xsl:call-template name="custodian"/>
					<xsl:call-template name="documentGeneral"/>					
				</div>
				
				</body>
			</html>
			</xsl:when>
			<!-- END TIPO DOC REFERTO 11502-2 -->
			<!-- START TEMPLATE RICOVERO 29305-0 o PDT su ROSSA -->
			<xsl:when test="$codeDocument='34112-3' or $codeDocument='57830-2' or (string-length($setIdExtension)&lt;=15 and ($codeDocument = '29305-0' or $codeDocument='57833-6' or $codeDocument='57832-8'))">
			<html>
      			<head>
					<style type="text/css">
					/*@font-face { font-family: "Barcode"; font-style: normal; font-weight: normal; font-stretch: normal;src:url('data:application/font-truetype;charset=ANSI;base64,[encoded data, 9628 characters]') format('truetype');}*/
						body { cursor: default; font-size: 84%; font-family : Verdana,Geneva, Arial, Helvetica, sans-serif; padding: 0px;margin: 0px;background-image:url('data:image/jpeg;base64,[encoded data, 110132 characters]'); background-position : top-left; background-repeat : no-repeat;}
						#indietro{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : normal;position: absolute;top: 536px;left: 100px;}
						#stampa{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : normal;position: absolute;top: 536px;left: 250px;}
						#stampaAutomatizzata{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 7px;left: 699px;}
						#siglaUslRes{font-family : "Courier New",Courier,monospace;font-size: 13px;font-weight : normal;position: absolute;top: 141px;left: 417px;letter-spacing: 12px;}
						#codUslRes{font-family : "Courier New",Courier,monospace;font-size: 13px;font-weight : normal;position: absolute;top: 141px;left: 457px;letter-spacing: 12px;}
						#CFBarCode{font-family: 'Free 3 of 9 Extended';font-size: 35px;height: 26px;overflow: hidden;font-weight : normal;position: absolute;top: 70px;left: 432px;}
						#codiceFiscale{font-family: "Courier New", Courier, monospace;font-size: 13px;font-weight : normal;position: absolute;top: 106px;left: 395px;letter-spacing : 12px;}
						#nominativo {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 13px;font-weight : normal;position: absolute;top: 10px;left: 25px;}
						#indirizzo {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 12px;font-weight: normal;position: absolute;top: 40px;width: 315px;left: 25px;height: 31px;overflow: hidden;}
						#checkEsenteN{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 140px;left: 25px;}
						#checkEsenteR{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight: bold;position: absolute;top: 140px;left: 203px;}
						#codiceEsenzione{font-family: "Courier New", Courier, monospace;font-size: 13px;font-weight : normal;position: absolute;top: 141px;left: 65px;letter-spacing: 13px;}
						#suggerita{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight: bold;position: absolute;top: 181px;left: 607px;}
						#ricovero{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 17px;font-weight : bold;position: absolute;top: 180px;left: 651px;}
						#altro {font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;font-size: 15px;font-weight: bold;left: 697px;position: absolute;top: 181px;}
						#urgente{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 215px;left: 607px;}
						#breve{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 215px;left: 637px;}
						#differita{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 215px;left: 667px;}
						#programmata{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 15px;font-weight : bold;position: absolute;top: 215px;	left: 697px;}
						#notaCUF1{font-family: "Courier New", Courier, monospace;font-size: 15px;font-weight : normal;position: absolute;top: 186px;left: 523px;letter-spacing: 12px;}
						#notaCUF2{font-family: "Courier New", Courier, monospace;font-size: 15px;font-weight: normal;position: absolute;top: 218px;left: 523px;letter-spacing : 12px;}
						#numPrestazioni{font-family: "Courier New", Courier, monospace;font-size: 13px;font-weight: normal;position: absolute;top: 316px;left: 109px;}
						#dataRilascio{font-family: "Courier New", Courier, monospace;font-size: 13px;font-weight: normal;position: absolute;top: 317px;left: 382px;letter-spacing: 13px;}
						#prescrittore{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 11px;font-weight : normal;position: absolute;top: 290px;left: 530px;}
						#codPrescrittore{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 12px;font-weight : normal;position: absolute;top: 270px;left: 530px;}
						#IUP{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 12px;font-weight : normal;position: absolute;top: 77px;left:245px;}
						#IUPBarCode{font-family : 'Free 3 of 9 Extended';font-size: 35px;height: 26px;overflow: hidden;font-weight : normal;position: absolute;top: 100px;left: 145px;}
						#Prescrizione14px{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;font-size: 14px;font-weight: normal;line-height: 14px;position: absolute;top: 181px;left: 35px;width: 460px;height: 125px;}
						#Prescrizione13px{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 13px; position: absolute;top: 181px; left: 35px; width: 460px; height: 125px;}
						#Prescrizione12px{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; line-height: 12px; position: absolute; top: 181px; left: 35px; width: 460px; height: 125px;}
						#Prescrizione11px{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; line-height: 11px; position: absolute; top: 183px; left: 35px; width: 460px; height: 125px;}
						#Prescrizione10px{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: normal; line-height: 10px; position: absolute; top: 183px; left: 35px; width: 460px; height: 125px;}
						#filigrana {float: left;left: 73px;position: absolute;text-align: center;top: 126px;transform: rotate(330deg);}
						#filigrana .testo-filigrana { font-size: 24px; letter-spacing: 4px; opacity: 0.35; }
						#filigrana .filigrana-subtitle{ font-size: 12px; text-transform: uppercase; opacity: 0.35; }
					</style>
				</head>
				<body>
					<div id="stampaAutomatizzata">X</div>
					<!--   divisione U.S.L. residenza assistibile  -->
					<div id="siglaUslRes">
						<xsl:variable name="codASLAssistito" select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity/n1:scopingOrganization/n1:id/@extension"/>
						<xsl:call-template name="ASL_Decode"><xsl:with-param name="codice" select="$codASLAssistito"/></xsl:call-template>
					</div>
					<div id="codUslRes">
						<xsl:value-of select="substring(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension,4)"/>
					</div>
					<!--   divisione COGNOME-NOME   -->
					<div id="nominativo">
						<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
						<xsl:choose>
							<xsl:when test="$nullFlavor='MSK'">
								<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="getName">
									<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
								</xsl:call-template>
							</xsl:otherwise>
						</xsl:choose>
					</div>
					<!--   divisione INDIRIZZO e COMUNE DI RESIDENZA  -->
					<div id="indirizzo">
						<xsl:apply-templates select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr"/>
					</div>
					<!--   divisione CODICE FISCALE   -->
					<div id="codiceFiscale">
						<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
					</div>
					<!--   divisione CODICE FISCALE   -->
					<div id="CFBarCode">*<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>*</div>
					<!--   divisione CHECK NON ESENTE   -->
					<div id="checkEsenteN">
						<xsl:if test="not(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ESENZIONI'])">X</xsl:if>
					</div>
					<!--   divisione CHECK ESENTE REDDITO   -->
					<div id="checkEsenteR"/>
					<!--   divisione CODICE ESENZIONE   -->
					<div id="codiceEsenzione">
						<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ESENZIONI']/n1:entry/n1:act/n1:code/@code"/>
					</div>
					<!--   divisione prescrizione SUGGERITA   -->
					<xsl:variable name="tipoPresc" select="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@codeSystem='2.16.840.1.113883.2.9.6.1.46']/@code"/>
					<div id="suggerita">
						<xsl:if test="$tipoPresc='S'"><xsl:text>X</xsl:text></xsl:if>
					</div>				
					<!--   divisione prescrizione RICOVERO   -->
					<div id="ricovero">
						<xsl:if test="$tipoPresc='H'"><xsl:text>X</xsl:text></xsl:if></div>
					<div id="altro">
						<xsl:if test="$tipoPresc='A'"><xsl:text>X</xsl:text></xsl:if>
					</div>
					<!--   divisione prescrizione priorita -->							
					<xsl:choose>
					<xsl:when test="$codeDocument='11488-4' or $codeDocument='57832-8'">
						<xsl:call-template name="prioritaRicettaRossa">					
							<xsl:with-param name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRIORITA']/n1:entry/n1:procedure/n1:priorityCode/@code"/>
						</xsl:call-template>
					</xsl:when>
					<xsl:otherwise>
						<xsl:call-template name="prioritaRicettaRossa">					
							<xsl:with-param name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:act/n1:priorityCode/@code"/>
						</xsl:call-template>
					</xsl:otherwise>					
					</xsl:choose>
					<!--   prestazioni o farmaci prescritti    -->
					<div id="notaCUF2"/>
					<div id="notaCUF1"/>
					<div id="Prescrizione10px">
					<div id="filigrana">
							<span class="testo-filigrana">COPIA PER IL PAZIENTE</span>
							<br/><br/>
							<span class="filigrana-subtitle">Conforme all'originale</span>
						</div>
						<!-- campo richiesta -->
						<xsl:if test="$codeDocument='29305-0' or $codeDocument='57833-6'">
							<xsl:variable name="numPrescrizioni" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item)"/>
							<xsl:call-template name="ciclaPrescrizioniRossaFarma">
								<xsl:with-param name="count" select="$numPrescrizioni"/>
							</xsl:call-template>		
						</xsl:if>
						<xsl:if test="$codeDocument='11488-4' or $codeDocument='57832-8'">
							<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:text/n1:list[@ID='RQO']">
								<xsl:for-each select="./n1:item/n1:content">															
									<xsl:variable name="ref" select="./@ID"/>
									<xsl:variable  name="obs" select="./../../../../n1:entry/n1:observation[child::n1:code/n1:originalText/n1:reference/@value=$ref]"/>
									<xsl:value-of select="./../../../../n1:entry/n1:observation/n1:code/n1:originalText/n1:reference[@value=$ref]/../../@code"/>
									<xsl:text>:</xsl:text>
									<xsl:value-of select="./text()"/>								
									<xsl:variable name="diagnosi" select="$obs/child::n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:text/text()"/>
									<xsl:variable name="diagnosiICD9CM" select="$obs/child::n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:code[@codeSystem='2.16.840.1.113883.6.2']/@code"/>
									<xsl:variable name="diagnosiICD9CM-DN" select="$obs/child::n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:code[@codeSystem='2.16.840.1.113883.6.2']/@displayName"/>
									<xsl:variable name="diagnosiICD9CM-STR" select="concat($diagnosiICD9CM,'-',$diagnosiICD9CM-DN)"/>
									<xsl:variable name="nota" select="$obs/child::n1:entryRelationship[@typeCode='SUBJ']/n1:act/n1:text/text()"/>
									<xsl:variable name="quantity" select="$obs/child::n1:entryRelationship[@typeCode='COMP']/n1:supply/n1:quantity/@value"/>
									<xsl:variable name="tipoaccesso" select="$obs/child::n1:entryRelationship[@typeCode='SAS']/n1:encounter/@moodCode"/>
									<xsl:if test="string-length($quantity)>0">
										<xsl:value-of select="concat(' -n:',$quantity,' ')"/>									
									</xsl:if>
									<xsl:if test="string-length($tipoaccesso)>0">
										<xsl:if test="$tipoaccesso='APT'">
											<xsl:text>-ta:1 </xsl:text>
										</xsl:if>
										<xsl:if test="$tipoaccesso='ENV'">
											<xsl:text>-ta:0 </xsl:text>
										</xsl:if>
									</xsl:if>
									<xsl:if test="string-length($nota)>0">
										<xsl:value-of select="concat('-nota:',$nota,' ')"/>									
									</xsl:if>
									<br/>
									<xsl:if test="string-length($diagnosiICD9CM-STR)>1 or string-length($diagnosi)>0">
										<xsl:text>-qd:</xsl:text>
										<xsl:choose>
											<xsl:when test="string-length($diagnosiICD9CM-STR)>1 and string-length($diagnosi)>0">
											<xsl:value-of select="concat($diagnosiICD9CM-STR,' - ',$diagnosi)"/>
										</xsl:when>
											<xsl:otherwise>
												<xsl:if test="string-length($diagnosiICD9CM-STR)>1">
													<xsl:value-of select="$diagnosiICD9CM-STR"/>
												</xsl:if>
												<xsl:if test="string-length($diagnosi)>0">
											<xsl:value-of select="$diagnosi"/>
												</xsl:if>
										</xsl:otherwise>
										</xsl:choose>
									</xsl:if>								
									<br/>
								</xsl:for-each>
								<br/>
							</xsl:for-each>
						</xsl:if>
						<!-- campo disgnosi (annotazione in wa)-->
						<xsl:if test="$codeDocument='34112-3' or $codeDocument='57830-2'">
							<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:text/n1:list">
								<xsl:if test="./@ID='DIAG'">
									<xsl:value-of select="concat('-ann:',./n1:item/n1:content/text())"/>
								</xsl:if>						
								<xsl:if test="./@ID='RQO'">
									<xsl:value-of select="./n1:item/n1:content/text()"/>
								</xsl:if>		
								<br/>				
							</xsl:for-each>
						</xsl:if>								
					</div>
					<!--   divisione NUMERO PRESTAZIONI   -->
					<div id="numPrestazioni">
					<xsl:variable name="numPrest" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry)"/>
					<xsl:if test="$numPrest>0">
						<xsl:value-of select="$numPrest"/>
					</xsl:if>
					</div>
					<!--   divisione DATA RILASCIO   -->
					<div id="dataRilascio">
						<xsl:call-template name="formatTimestampSHORT">
							<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/>
						</xsl:call-template>
					</div>
					<!--   divisione NOMINATIVO PRESCRITTORE   -->
					<div id="prescrittore">
						cod.reg.<xsl:value-of select="/n1:ClinicalDocument/n1:author[1]/n1:assignedAuthor[1]/n1:id[2]/@extension"/>
						<br/> 
						<xsl:call-template name="getName">
							<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name"/>
						</xsl:call-template>
					</div>
					<!--   divisione CODICE PRESCRITTORE   -->
					<div id="codPrescrittore"/>
					<!--   divisione IUP   -->
					<div id="IUP">
						XXXXXXXXXXXXX
					</div>
					<!--   divisione IUP bar code  -->
					<div id="IUPBarCode">*XXXXXXXXXXXXX*</div>
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC RICOVERO 34112-3 o ROSSA-->
			<!-- TEMPLATE DEMA FARMA 29305-0 or 57833-6 e SPEC 11488-4 or 57832-8-->
			<xsl:when test="$codeDocument = '29305-0' or $codeDocument='57833-6' or $codeDocument='57832-8'">
			<html>
				<head>	
					<style type="text/css">
						@page { size: 210mm 297mm; margin: 5mm }
						/*@font-face { font-family: "Barcode"; font-style: normal; font-weight: normal; font-stretch: normal;src:url('data:application/font-truetype;charset=ANSI;base64,[encoded data, 9628 characters]') format('truetype');}*/
						* {margin: 0;padding: 0;}
						body {background: white;width: 210mm;height: 297mm; margin: 5mm;font-size: 84%;font-family: Tahoma, Geneva, Arial, Helvetica, sans-serif;}						
						#outer_text { border: 0 none;  font-size: 12px;  height: 16px;  left: 17px;  position: absolute;  text-transform: uppercase;  top: 10px;  width: 709px;}
						#outer_text_1{float: left;height: 14px;}
						#outer_text_2{float: right;height: 14px;}
						#header {  border: 1px solid #000;  height: 55px;  left: 17px;  position: absolute;  top: 24px;  width: 709px;}
						#header_logo{position: relative;top: 0;left:0;border-right: 1px solid #000;width: 215px;height: 55px;overflow: hidden;float: left;}
						#image_logo_regione{float: left;}
						#header_regione  {border: 0 none;font-size: 20px;height: 20px;line-height: 20px;margin: 0 auto;overflow: hidden;padding: 0;position: relative;top: 16px;width: 180px;float: left;}
						#header_data {  float: left;  height: 53px;  margin: 0 auto;  overflow: hidden;  width: 492px;}
						#first_divisor{  background-color: #000;  border: medium none;  color: #000;  height: 1px;  left: 15px;  position: absolute;  top: 136px;  width: 710px;}
						/* STILI PER I LINK */div.sub a {color: #000;position: relative;float: left;margin: 0em 0.3em 0em 0.3em;text-decoration: none;background-color: #F5F5DC;border: solid 1px #000;padding: 0.2em 0.2em 0.2em 0.2em;}
						div.sub a:hover {color: #C00;position: relative;float: left;margin: 0em 0.3em 0em 0.3em;text-decoration: none;background-color: #FFE6CC;border: solid 1px #000;padding: 0.2em 0.2em 0.2em 0.2em;}
						/* STILI PER LA RICETTA */
						#NREBarCodePrima {  font-family: "Free 3 of 9 Extended";  font-size: 35px;  font-weight: normal;  height: 26px;  left: 388px;  overflow: hidden;  position: absolute;  top: 7px;}
						#NREBarCodeSeconda {  font-family: "Free 3 of 9 Extended";  font-size: 35px;  font-weight: normal;  height: 26px;  left: 507px;  overflow: hidden;  position: absolute;  top: 7px;}
						#NREPrima {  left: 404px;  position: absolute;  top: 35px;}
						#NRESeconda {  left: 529px;  position: absolute;  top: 35px;}
						/* DATI ANAGRAFICI CITTADINO ITALIANO O STP/ENI */#nominativo {  height: 22px;  left: 246px;  letter-spacing: -1px;  overflow: hidden;  position: absolute;  top: 87px;  width: 221px;}
						#nominativoLabel {position: absolute;left: 17px;top: 85px;}
						#indirizzo {  height: 23px;  left: 76px;  letter-spacing: -1px;  line-height: 11px;  overflow: hidden;  position: absolute;  top: 111px;  width: 154px;}
						#indirizzoLabel {position: absolute;left: 17px;top: 110px;}
						#cap {left: 253px;position: absolute;top: 111px;}
						#capLabel {position: absolute;left: 229px;top: 110px;}
						#comune {line-height: 11px;left: 330px;position: absolute;top: 112px;width: 133px;letter-spacing: -1px;height: 23px;overflow: hidden;}
						#comuneLabel {position: absolute;left: 292px;top: 110px;}
						#provincia {left: 496px;line-height: 11px;position: absolute;top: 111px;}
						#provinciaLabel {position: absolute;left: 464px;top: 110px;}
						#CFBarCode {  font-family: "Free 3 of 9 Extended";  font-size: 35px;  font-weight: normal;  height: 26px;  left: 467px;  overflow: hidden;  position: absolute;  top: 83px;}
						#codiceFiscale {font-size: 16px;position: absolute;top: 109px;left: 524px;}
						/* DATI ANAGRAFICI CITTADINO STRANIERO */#istituzioneCompetente {  height: 22px;  left: 200px;  letter-spacing: -1px;  overflow: hidden;  position: absolute;  top: 87px;  width: 190px;}
						#istituzioneCompetenteLabel {position: absolute;left: 17px;top: 85px;}
						#numIdentificazionePersonale {left: 182px;position: absolute;top: 112px;width: 126px;height: 23px;overflow: hidden;}
						#numIdentificazionePersonaleLabel {position: absolute;left: 17px;top: 110px;}
						#dataNascita {left: 486px;position: absolute;top: 87px;width: 64px;letter-spacing: -1px;height: 24px;overflow: hidden;}
						#dataNascitaLabel {position: absolute;left: 389px;top: 85px;}
						#numIdentificazioneTessera {left: 496px;position: absolute;top: 112px;width: 134px;height: 23px;overflow: hidden;}
						#numIdentificazioneTesseraLabel {position: absolute;left: 308px;top: 110px;}
						#dataScadenza {left: 658px;position: absolute;top: 87px;width: 64px;letter-spacing: -1px;height: 24px;overflow: hidden;}
						#dataScadenzaLabel {position: absolute;left: 551px;top: 85px;}
						#statoEstero {left: 710px;position: absolute;top: 112px;width: 20px;height: 23px;overflow: hidden;}
						#statoEsteroLabel {position: absolute;left: 630px;top: 110px;}
						#codiceEsenzioneLabel{position: absolute;left: 17px;top: 137px;}
						#codiceEsenzione {  font-weight: normal;  left: 80px;  position: absolute;  top: 138px;  width: 139px;}
						.field{font-family: "Courier New", Courier, monospace;font-size: 10px;font-weight: normal;line-height: 10px;}
						.fieldLabel{font-size: 10px;line-height: 10px;font-weight: normal;}
						#siglaUslResLabel {   left: 215px;  position: absolute;  top: 137px;  width: 139px;}
						#siglaUslRes {  left: 312px;  position: absolute;  top: 138px;}
						#codUslResLabel {    left: 367px;  position: absolute;  top: 137px;}
						#codUslRes {  left: 432px;  position: absolute;  top: 138px;}
						#tipologia_prescrizioneLabel{left: 17px;position: absolute;top: 154px;}
						#tipologia_prescrizione {  left: 171px;  position: absolute;  top: 155px;}
						#disposizioni_regionaliLabel {   left: 511px;  position: absolute;  top: 137px;}
						#disposizioni_regionali {  left: 647px;  position: absolute;  top: 138px;}
						#altroLabel {    left: 205px;  position: absolute;  top: 154px;}
						#altro {  left: 242px;  position: absolute;  top: 155px;}
						/* PARTE RELATIVA ALLE SINGOLE PRESTAZIONI */
						#priorita_prescrizioneLabel {  left: 277px;  position: absolute;  top: 154px;}#priorita_prescrizione {  height: 13px;  left: 451px;  letter-spacing: -1px;  line-height: 11px;  overflow: hidden;  position: absolute;  top: 155px;  width: 297px;  word-spacing: -3px;}
						#quesitoDiagnosticoLabel {  left: 17px;  overflow: hidden;  position: absolute;  top: 169px;  width: 123px;   }
						#quesitoDiagnostico{  left: 140px;  overflow: hidden;  position: absolute;  top: 169px;  width: 589px; }
						#numPrestazioniLabel{left: 17px;    position: absolute;    top: 185px;}
						#numPrestazioni {  left: 165px;  position: absolute;  top: 185px;}
						#tipoRicettaLabel{left: 175px;    position: absolute;    top: 185px;}
						#tipoRicetta {    left: 250px;    position: absolute;    top: 185px;}
						#dataRilascioLabel{left: 318px;    position: absolute;    top: 185px;}
						#dataRilascio {  left: 350px;  position: absolute;  top: 185px;}
						#codFiscalePrescrittoreLabel{  left: 447px;  position: absolute;  top: 185px;}
						#codFiscalePrescrittore {  left: 602px;  position: absolute;  top: 185px;}
						#codAutenticazioneLabel{position: absolute;    top: 199px;    left: 17px;}
						#codAutenticazione {  left: 166px;  position: absolute;  top: 199px;}
						#nominativoMedicoLabel{left: 382px;    position: absolute;    top: 199px;}#nominativoMedico {  height: 14px;  left: 551px;  overflow: hidden;  position: absolute;  top: 199px;  width: 180px;}.testo_prescrizione {font-family: "Courier New", Courier, monospace;font-size: 10px;font-weight: normal;line-height: 10px;  height: 25px;  line-height: 10px;  overflow: hidden;}
						table{border-collapse: collapse; border-spacing: 0; } 
						#table_wrapper {  border: 1px solid #000;    height: 308px;  left: 15px;  position: absolute;  top: 215px;  width: 714px;  overflow: hidden;}
						#table_wrapper table.table_prescrizioni{border-bottom: 1px solid #000;}
						#table_wrapper table.table_prescrizioni, #table_wrapper table.table_prescrizioni tbody{ display: block; height: 93px; }#table_wrapper table td.table_prescrizioni_field{display: block; float: left; border-left: 1px solid #000;}#table_wrapper table td.table_prescrizioni_field_first{display: block; float: left; border-bottom: 1px solid #000;}#table_wrapper table td.table_prescrizioni_field1{ width: 606px;}#table_wrapper table td.table_prescrizioni_field2,#table_wrapper table td.table_prescrizioni_field3{ width: 53px;border-bottom: 1px solid #000; }#table_wrapper table td.table_prescrizioni_field2 .testo_prescrizione,#table_wrapper table td.table_prescrizioni_field3 .testo_prescrizione{ text-align: center; }
						#table_wrapper table tr {    height: 25px;}
						#table_wrapper table tr.table_prescrizioni_intestazione, #table_wrapper table tr.table_prescrizioni_intestazione td{height: 15px;}
						#table_wrapper table tr.table_prescrizioni_dati {  display: block;  height: 26px;}
						.table_prescrizioni_intestazione{ display: block;text-align: center; font-size: 8px; }
						#table_footer1 table,#table_footer2 table,#table_footer1 tbody,#table_footer2 tbody{display: block;}
						#table_footer1 {  float: left;  height: 220px;  width: 485px;}
						#table_footer1 table{height: 109px;}
						#table_footer1 table tr{height: 109px;display: block;}
						#table_footer2 div.first{height: 158px;border: 0 none;border-bottom:1px solid #000;}
						#table_footer2 #blocchetti1 {  height: 27px;  margin: 0 auto;  position: relative;  top: 76px;  width: 125px;}
						#table_footer2 #blocchetti2 {  height: 27px;  left: 60px;  position: relative;  top: 1px;  width: 161px;}
						#table_footer2 #blocchetti1 ul{}
						#table_footer2 #blocchetti1 ul li, #table_footer2 #blocchetti2 ul li {  border: 1px solid #000;  float: left;  height: 24px;  list-style: outside none none;  margin-left: -1px;  width: 19px;}
						#table_footer2 #blocchetti2 ul li.last-li {  border: 0 none;  padding: 0 5px;}
						#subtitle-sped {  display: block;  left: 0;  position: relative;  text-align: center;  top: 76px;  width: 225px;}
						#subtitle-prog {  display: block;  left: 0;  position: relative;  text-align: center;  top: 93px;  width: 225px;}
						#table_footer2 table tr.second{height: 54px;display: block;border: 0 none;}
						#table_footer1 table tr td{  border-right: 1px solid #000;  border-bottom: 1px solid #000;  display: block;  float: left;  height: 109px;  width: 160px;}
						#table_footer2 {    height: 218px;  width: 229px;  float: right;}
						#title-importi{  display: block;  left: 0;  position: relative;  text-align: center;    width: 225px;}
						.subtitle{font-size:7px;line-height:7px;}
						#filigrana {  float: left;  left: 0;  position: absolute;  top: 134px;  transform: rotate(330deg);  text-align: center;}
						#filigrana .testo-filigrana {  font-size: 24px;  letter-spacing: 4px;  opacity: 0.35;}
						#filigrana .filigrana-subtitle{font-size: 12px;text-transform: uppercase; opacity: 0.35;}
						#footer_wrapper {  font-size: 9px;  font-style: italic;  height: 20px;  left: 139px;  letter-spacing: 0;  position: absolute;  top: 525px;  width: 460px;}
				<xsl:if test="$codeDocument='11488-4' or $codeDocument='57832-8'">
					<xsl:text>#table_wrapper{border: 0 none;border-top: 1px solid #000;width: 716px;top:170px;}
						#table_wrapper table.table_prescrizioni, #table_wrapper table.table_prescrizioni tbody{height: auto;}
						#table_wrapper .table_prescrizioni tr{border-left: 1px solid #000;border-right: 1px solid #000;}
						#quesitoDiagnosticoLabel {  left: 17px;  overflow: hidden;  position: absolute;  top: 424px;  width: 589px;   }
						#quesitoDiagnostico{  left: 140px;  overflow: hidden;  position: absolute;  top: 424px;  width: 589px; }
						#nominativoMedicoLabel{left: 382px;    position: absolute;    top: 454px;width: 169px;}
						#nominativoMedico {  height: 14px;  left: 551px;  overflow: hidden;  position: absolute;  top: 454px;  width: 180px;}
						#numPrestazioniLabel{left: 17px;    position: absolute;    top: 440px;}
						#numPrestazioni {  left: 160px;  position: absolute;  top: 440px;}
						#tipoRicettaLabel{left: 175px;    position: absolute;    top: 440px;}
						#tipoRicetta {    left: 250px;    position: absolute;    top: 440px;}
						#dataRilascioLabel{left: 318px;    position: absolute;    top: 440px;}
						#dataRilascio {  left: 350px;  position: absolute;  top: 440px;}
						#codFiscalePrescrittoreLabel{  left: 447px;  position: absolute;  top: 440px;  width: 152px;}
						#codFiscalePrescrittore {  left: 602px;  position: absolute;  top: 440px;  width: 129px;}
						#codAutenticazioneLabel{position: absolute;    top: 454px;    left: 17px;}
						#codAutenticazione {  left: 166px;  position: absolute;  top: 454px;}
						#filigrana{top:103px;}
						#footer_wrapper{top:466px;}
					</xsl:text>
				</xsl:if>
				</style>
				</head>
				<body>
					<div id="outer_text">
						<div id="outer_text_1">
							<span>SERVIZIO SANITARIO NAZIONALE</span>
						</div>
						<div id="outer_text_2">
							<span>RICETTA ELETTRONICA - PROMEMORIA PER L'ASSISTITO</span>
						</div>
					</div>
					<div id="header">
						<div id="header_logo">
							<img id="image_logo_regione" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAA1CAMAAAD8iKLtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURUVFRUhISElJSUpKSlBQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2FhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vr+/v8DAwMHBwcLCwsPDw8TExMXFxcbGxsfHx8jIyMnJycrKysvLy8zMzM3Nzc7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dra2tvb29zc3N3d3d7e3t/f3+Dg4OHh4ePj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr6+zs7O3t7e7u7vDw8PHx8fLy8vPz8/T09PX19fb29vf39/j4+Pn5+fr6+vv7+/z8/P39/f7+/v///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIs2GmkAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAAUoSURBVEhLfZSLX9NWFMedD6hQhDmhNMlNESiClDYptE0LLWqB2gdKgQGjiEgF6uxE3KBDQOxQEOkL54sNVFAebZL2X9zJo8x9Ptt++eTe3Hu/99xzknNyIicqy8aez0yMuVtbGPsVn997039/Khrns+KiyHz5yXfFOxYIeNup+vrqWnOrxdXd973f4xx9l2fSnuC1hoaay3U/P+jvN1c1DCUDC51aU4NJ19K5IzMHLd6Rbl+LuWziRWhcV23wv56LXFI52h4NdVv3ZSbb5Qn19+vqqofHu3s6GV8w5Jl06BquTvgYMyszaaq9x9nX43L5x368eztwayw4HpoOeLyDzq52WBYZvn/Ea6W1CNdodWZX/+TDh4uRe51N2mqtc/RAZr50NJaePVtSrtE2O26Mhh7NLz2L3vV1NNfgdTcyMpP7HO6+1ma3tXZ0XO247u8dvj0x1tPldF4fmhTMSAwcl9ldWZqPzEUiv0Z+uD+3+Di6kU4L/gqSmf8VMFN9vf8tfy8vMN7fni4vL0efQis8iJ34IHRPK0Xm5qtEIplKJqCFLp6EDgZil0xsIonZXLo5sBq/7wkm14d888lF38BafModSqwOdC+kSJHpTtgpg+sxTVH3BmnaHG010u45A01N91GUZYMQGd+6maabwxRl7PHRtGHaRNOmEDBDXTStfyLZ8aUGDE2+tTaq8ZcZo5552WvQDa7Z9Pr5B7TeJvvj24w9nInFV8NL8dhieC0em5mNbz4PR5PxhfB6nnmVEqKCQBLJTSGWVHIzlUylhEATKckfk9ftdns8Hpfd7nC0t7c7HA673e4Spjxur1JkaKuZYSwMg6lxUQRB4Li6EuYsMF0oMYyVAWE4iRASbkEkobYyVitjkxijiOAEQphakNBiCOFqBjZ/xVhxDJHY4MqzlRXxHlGDLRzmZYYGo+AFUgcyPMexXziO49lgJbiFWaxWmbFZcIwksECG2/+4HTUFP8UO+XRQDT7hecZoBXcFhN3VWzWoFDOV3+HZo7sYAT7JDEUQJMJGjrjdsaozZ5SKCmXpxSf7PDuJC5YUIlMNvhC3Myy3o1YUfltQWlCk/E41y3LpSVjAT4hMrQZht9Lg7mpFwbnSwuLzhSXnlSaW49ITGEGelBgSaXbhL8KGUXHJ6ZNlBUVny4vrtrhcdhdHmlMyQ1btZXPZ91jhacU3pxSnThcUlSmcbDb3CSGNZEerIas+Q4l8QOfPEZ1VxDlSUVl1cZnL5faO7Wg1SGTSm8PkOPuxfnK7puGCLQOnA0Pmz5IYnkvvHPEHhgi3+vHOIcd/baeWJERGVPbQOMtnQcJgDyeq/oXJHdKzYAEQ0c4xg9BFiEvWETUjGQFulyDkuAR/9mCXpAN6Wuaz8H7+Zgj0hssb2tc/yD+yb9X591MD2dT0B8tl+SzHsjuXgizLw5Ysu20gSZmpVyGc0L9js5AQb1c7NYa1D7Ahx/9pQARSST7TehXkXON7npt12RnqanOr2Te2z27rIfNVeik3jLYmFexofMOm3ww6ugZH+6eGXx8CQpCqpnwetjL6CkjxxrcsUI8WwluHHLulJwmyQndcFzbGaihHiLgMkCCOzWw1wRgQxpY/C2pEgFCtvbVNUh2MKpqg7PJngR2A4DgNlCmBSKhVDSA6Ydoq2aGgikCGcoKEZeGCc5BKLyIW6b/xOwQg7L2gUCpLlCWqkqLiomJFmVT5mpfSP5zf2djYiMENWu/F/WsvQGLzIiZ8R4H5p5jjzyspl/sLsa3XEoqLYVQAAAAASUVORK5CYII="/>
							<div id="header_regione">
								<span>REGIONE PUGLIA</span>
							</div>
						</div>
						<xsl:variable name="nreIup" select="/n1:ClinicalDocument/n1:id/@extension"/>
						<xsl:variable name="nrelenght" select="string-length($nreIup)"/>
						<div id="header_data">
							<!--   divisione NRE prima parte   -->
							<div id="NREPrima">*<xsl:value-of select="substring($nreIup,1,5)"/>*</div>
							<!--   divisione NRE bar code prima parte  -->
							<div id="NREBarCodePrima">*<xsl:value-of select="substring($nreIup,1,5)"/>*</div>
							<!--   divisione NRE seconda parte   -->
							<div id="NRESeconda">*<xsl:value-of select="substring($nreIup,6,$nrelenght)"/>*</div>
							<!--   divisione NRE bar code seconda parte  -->
							<div id="NREBarCodeSeconda">*<xsl:value-of select="substring($nreIup,6,$nrelenght)"/>*</div>
						</div>
					</div>
					<xsl:if test="$qualifierTipoAss!='ST'">
						<!--if (!flagEstero) {!-->
						<!--   divisione COGNOME-NOME   -->
						<div id="nominativoLabel" class="fieldLabel">COGNOME E NOME/INIZIALI DELL'ASSISTITO:</div>
						<div id="nominativo" class="field">
							<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
							<xsl:choose>
								<xsl:when test="$nullFlavor='MSK'">
									<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:call-template name="getName">
										<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
									</xsl:call-template>
								</xsl:otherwise>
							</xsl:choose>
						</div>
						<!--   divisione INDIRIZZO DI RESIDENZA ASSISTIBILE -->
						<div id="indirizzoLabel" class="fieldLabel">INDIRIZZO:</div>
						<div id="indirizzo" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:streetAddressLine"/>
						</div>
						<!--   divisione CAP DEL COMUNE DI RESIDENZA ASSISTIBILE  -->
						<div id="capLabel" class="fieldLabel">CAP:</div>
						<div id="cap" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:postalCode"/>
						</div>
						<!--   divisione COMUNE DI RESIDENZA ASSISTIBILE  -->
						<div id="comuneLabel" class="fieldLabel">CITTA':</div>
						<div id="comune" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:city"/>
						</div>
						<!--   divisione PROVINCIA DEL COMUNE DI RESIDENZA ASSISTIBILE  -->
						<div id="provinciaLabel" class="fieldLabel">PROV:</div>
						<div id="provincia" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:country"/>
						</div>
						<!--   divisione CODICE FISCALE   -->
						<div id="codiceFiscale">*<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>*</div>
						<!--   divisione CODICE FISCALE bar code   -->
						<div id="CFBarCode">*<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>*</div>
					</xsl:if>
					<!-- flagEstero) -->
					<xsl:if test="$qualifierTipoAss='ST'">
						<!--   divisione CODICE ISTITUZIONE COMPETENTE   -->
						<div id="istituzioneCompetenteLabel" class="fieldLabel">CODICE ISTITUZIONE COMPETENTE:</div>
						<div id="istituzioneCompetente" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@assigningAuthorityName"/>
						</div>
						<!--   divisione N. IDENTIFICAZIONE PERSONALE   -->
						<div id="numIdentificazionePersonaleLabel" class="fieldLabel">N. IDENTIFICAZIONE PERSONALE:</div>
						<div id="numIdentificazionePersonale" class="field">
							<xsl:value-of select="substring(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension,4)"/>
						</div>
						<!--   divisione N. IDENTIFICAZIONE DELLA TESSERA   -->
						<div id="numIdentificazioneTesseraLabel" class="fieldLabel">N. IDENTIFICAZIONE DELLA TESSERA:</div>
						<div id="numIdentificazioneTessera" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
						</div>
						<!--   divisione DATA DI NASCITA   -->
						<div id="dataNascitaLabel" class="fieldLabel">DATA DI NASCITA:</div>
						<div id="dataNascita" class="field">
							<xsl:call-template name="formatTimestamp">
								<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
							</xsl:call-template>
						</div>
						<!--   divisione DATA DI SCADENZA   -->
						<div id="dataScadenzaLabel" class="fieldLabel">DATA DI SCADENZA:</div>
						<div id="dataScadenza" class="field">
							<xsl:if test="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value>0">
								<xsl:call-template name="formatTimestamp">
									<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value"/>
								</xsl:call-template>
							</xsl:if>
						</div>
						<!--   divisione STATO ESTERO   -->
						<div id="statoEsteroLabel" class="fieldLabel">STATO ESTERO:</div>
						<div id="statoEstero" class="field">
							<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place/n1:addr/n1:county"/>
						</div>
					</xsl:if>
					<hr id="first_divisor"/>
					<!--  10 divisione CODICE ESENZIONE   -->
					<div id="codiceEsenzioneLabel" class="fieldLabel">ESENZIONE:</div>
					<div id="codiceEsenzione" class="field">
						<xsl:variable name="esenzione">
							<xsl:choose>
								<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)">
									<xsl:choose>
										<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text != 'RICETTA NON ESENTE'">
											<xsl:choose>
												<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code)">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code/@code"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="'NON ESENTE'"/>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="'NON ESENTE'"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:value-of select="$esenzione"/>
					</div>
					<!-- 11-12   divisione U.S.L. residenza assistibile  -->
					<div id="siglaUslResLabel" class="fieldLabel">SIGLA PROVINCIA:</div>
					<div id="siglaUslRes" class="field">
						<xsl:variable name="codASLAssistito" select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity/n1:scopingOrganization/n1:id/@extension"/>
						<xsl:call-template name="ASL_Decode"><xsl:with-param name="codice" select="$codASLAssistito"/></xsl:call-template>
					</div>
					<div id="codUslResLabel" class="fieldLabel">CODICE ASL:</div>
					<div id="codUslRes" class="field">
						<xsl:value-of select="substring(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension,4)"/>
					</div>
					<!-- 13  divisione disposizioni regionali -->
					<div id="disposizioni_regionaliLabel" class="fieldLabel">DISPOSIZIONI REGIONALI:</div>
					<div id="disposizioni_regionali" class="field">
						<xsl:if test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:code[@code='48767-8']]/n1:text/n1:content/@ID='dispReg')">
							<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:code[@code='48767-8']]/n1:text/n1:content"/>
						</xsl:if>
					</div>
					<!-- 14  divisione tipologia prescrizione -->
					<div id="tipologia_prescrizioneLabel" class="fieldLabel">TIPOLOGIA PRESCRIZIONE(S,H):</div>
					<div id="tipologia_prescrizione" class="field">
						<xsl:choose>
							<xsl:when test="$qualifierTipoPrescrizione='S'">
								<xsl:text>SUGG</xsl:text>
							</xsl:when>
							<xsl:when test="$qualifierTipoPrescrizione='H'">
								<xsl:text>RICOV</xsl:text>
							</xsl:when>
						</xsl:choose>
					</div>
					<!-- 15  divisione tipologia prescrizione Altro-->
					<div id="altroLabel" class="fieldLabel">ALTRO:</div>
					<div id="altro" class="field">
						<xsl:if test="$qualifierTipoPrescrizione='A'">X</xsl:if>
					</div>
					<!-- 16  divisione priorita prescrizione -->
					<div id="priorita_prescrizioneLabel" class="fieldLabel">PRIORITA' PRESCRIZIONE(U,B,D,P):</div>
					<div id="priorita_prescrizione" class="field">
						<xsl:if test="$codeDocument='29305-0' or $codeDocument='57833-6'">
							<xsl:variable name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:act/n1:priorityCode/@code"/>
							<xsl:choose>
								<xsl:when test="$priorita = 'U'">NEL PIU' BREVE TEMPO POSSIBILE; SE DIFFERIBILE ENTRO 72 ORE</xsl:when>
								<xsl:when test="$priorita = 'B'">ENTRO 10 GIORNI</xsl:when>
								<xsl:when test="$priorita = 'D'">ENTRO 30 (VISITE), ENTRO 60 GG (VISITE STRUMENTALI)</xsl:when>
								<xsl:when test="$priorita = 'P'">SENZA PRIORITA'</xsl:when>
								<xsl:otherwise>
									<xsl:text> </xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:if>
						<xsl:if test="$codeDocument='11488-4' or $codeDocument='57832-8'">
							<xsl:variable name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRIORITA']/n1:entry/n1:procedure/n1:priorityCode/@code"/>
							<xsl:choose>
								<xsl:when test="$priorita = 'U'">NEL PIU' BREVE TEMPO POSSIBILE; SE DIFFERIBILE ENTRO 72 ORE</xsl:when>
								<xsl:when test="$priorita = 'B'">ENTRO 10 GIORNI</xsl:when>
								<xsl:when test="$priorita = 'D'">ENTRO 30 (VISITE), ENTRO 60 GG (VISITE STRUMENTALI)</xsl:when>
								<xsl:when test="$priorita = 'P'">PROGRAMMABILE</xsl:when>
								<xsl:otherwise>
									<xsl:text> </xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:if>
					</div>
					<!-- 21-27 -->
					<!--  quesito diagnostico prescrizione -->
					<div id="quesitoDiagnosticoLabel" class="fieldLabel">QUESITO DIAGNOSTICO:</div>
					<div id="quesitoDiagnostico" class="field">
						<xsl:variable name="quesitoCode" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry/n1:observation/n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:code/@code"/>
						<xsl:variable name="quesito" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry/n1:observation/n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:code/@displayName"/>
						<xsl:if test="string-length($quesitoCode)>0">
							<xsl:value-of select="$quesitoCode"/>
						</xsl:if>
						<xsl:if test="string-length($quesito)>0">
							<xsl:if test="string-length($quesitoCode)>0">
								<xsl:text> - </xsl:text>
							</xsl:if>
							<xsl:value-of select="$quesito"/>
						</xsl:if>
						<xsl:variable name="quesitoTL" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry[1]/n1:observation/n1:entryRelationship[@typeCode='RSON']/n1:observation/n1:text"/>
						<xsl:if test="string-length($quesitoTL)>0">						
							<xsl:if test="string-length($quesitoCode)>0 or string-length($quesito)">
								<xsl:text> - </xsl:text>
							</xsl:if>						
							<xsl:value-of select="$quesitoTL"/>
						</xsl:if>
					</div>
					<!-- 22 NUMERO PRESTAZIONI   -->
					<div id="numPrestazioniLabel" class="fieldLabel">N.CONFEZIONI/PRESTAZIONI:</div>
					<div id="numPrestazioni" class="field">
						<xsl:if test="$codeDocument='29305-0' or $codeDocument='57833-6'">
							<xsl:variable name="numPrescrizioni" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item)"/>
							<xsl:call-template name="contaPrescrizioni">
								<xsl:with-param name="numItems" select="$numPrescrizioni"/>
								<xsl:with-param name="indice" select="1"/>
								<xsl:with-param name="count" select="0"/>
							</xsl:call-template>
						</xsl:if>
						<xsl:if test="$codeDocument='11488-4' or $codeDocument='57832-8'">
							<xsl:variable name="numPrescrizioni" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item)"/>
							<xsl:call-template name="contaPrescrizioniSPEC">
								<xsl:with-param name="numItems" select="$numPrescrizioni"/>
								<xsl:with-param name="indice" select="1"/>
								<xsl:with-param name="count" select="0"/>
							</xsl:call-template>
						</xsl:if>
					</div>
					<!-- 23 tipo ricetta -->
					<div id="tipoRicettaLabel" class="fieldLabel">TIPO RICETTA:</div>
					<div id="tipoRicetta" class="field">
						<xsl:call-template name="PRESCR-TIPO-RICETTA"/>
					</div>
					<!-- 24 DATA RILASCIO   -->
					<div id="dataRilascioLabel" class="fieldLabel">DATA:</div>
					<div id="dataRilascio" class="field">
						<xsl:call-template name="formatTimestamp">
							<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/>
						</xsl:call-template>
					</div>
					<!-- 25 CODICE PRESCRITTORE   -->
					<div id="codFiscalePrescrittoreLabel" class="fieldLabel">CODICE FISCALE DEL MEDICO:</div>
					<div id="codFiscalePrescrittore" class="field">
						<xsl:value-of select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:id/@extension"/>
					</div>
					<!-- 26 CODICE AUTENTICAZIONE   -->
					<div id="codAutenticazioneLabel" class="fieldLabel">CODICE AUTENTICAZIONE:</div>
					<div id="codAutenticazione" class="field">
						<xsl:value-of select="$setIdExtension"/>
					</div>
					<!-- 27 NOMINATIVO MEDICO   -->
					<div id="nominativoMedicoLabel" class="fieldLabel">COGNOME E NOME DEL MEDICO:</div>
					<div id="nominativoMedico" class="field">
						<xsl:call-template name="getName">
							<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name"/>
						</xsl:call-template>
					</div>
					<div id="table_wrapper">
						<!--div id="filigrana">
							<span class="testo-filigrana">PROMEMORIA PER IL PAZIENTE</span>
							<br/>
							<span class="filigrana-subtitle">Copia conforme all'originale ad eccezione dei dati relativi al NRE.</span>
						</div-->
						<table class="table_prescrizioni">
							<tbody>
								<tr class="table_prescrizioni_intestazione">
								
									<td class="table_prescrizioni_field_first table_prescrizioni_field1">
									<!-- Evolutiva nuovi LEA 22/02/2024 -->
									<!-- Vedere se siamo di fornte ad una specialistica, la dicitura dell'intestazione deve portare la nuova indicazione di validità della ricetta-->
									<xsl:choose>
											<xsl:when test="$codeDocument='57832-8'">
													<div class="table_prescrizioni_intestazione">PRESCRIZIONE VALIDA 180 GIORNI</div>
											</xsl:when>
											<xsl:otherwise>
												<div class="table_prescrizioni_intestazione">PRESCRIZIONE</div>
											</xsl:otherwise>
									</xsl:choose>
									</td>
									
									<td class="table_prescrizioni_field table_prescrizioni_field2">
										<div class="table_prescrizioni_intestazione">QTA</div>
									</td>
									<td class="table_prescrizioni_field table_prescrizioni_field3">
										<div class="table_prescrizioni_intestazione">NOTA</div>
									</td>
								</tr>
								<!--   divisione PRESCRIZIONI   -->
								<xsl:variable name="numPrescrizioni" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item)"/>
								<xsl:choose>
									<xsl:when test="$codeDocument='29305-0' or $codeDocument='57833-6'">
										<xsl:call-template name="ciclaPrescrizioni">
											<xsl:with-param name="count" select="$numPrescrizioni"/>
										</xsl:call-template>
									</xsl:when>
									<xsl:when test="$codeDocument='11488-4' or $codeDocument='57832-8'">
										<xsl:call-template name="ciclaPrescrizioniSPEC">
											<xsl:with-param name="count" select="$numPrescrizioni"/>
										</xsl:call-template>
									</xsl:when>
								</xsl:choose>
							</tbody>
						</table>
						<xsl:if test="$codeDocument='29305-0' or $codeDocument='57833-6'">
							<div id="table_footer1">
								<table>
									<tbody>
										<tr class="first">
											<td> </td>
											<td> </td>
											<td class="last"> </td>
										</tr>
										<tr>
											<td> </td>
											<td> </td>
											<td class="last"> </td>
										</tr>
									</tbody>
								</table>
							</div>
							<div id="table_footer2">
								<div class="first">
									<div id="blocchetti1">
										<ul>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
										</ul>
									</div>
									<div id="subtitle-sped">
										<span class="subtitle">DATA SPEDIZIONE/TIMBRO STRUTTURA EROGANTE</span>
									</div>
									<div id="subtitle-prog">
										<span class="subtitle">NUMERO PROGRESSIVO</span>
									</div>
								</div>
								<div class="second">
									<div id="title-importi">
										<span class="subtitle">IMPORTI</span>
									</div>
									<div id="blocchetti2">
										<ul>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
											<li> </li>
											<li class="last-li">
												<span class="subtitle">TICKET</span>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</xsl:if>
					</div>
					<div id="footer_wrapper">Rilasciato ai sensi dell'art.11, comma 16 del DL 31 mag 2010,n.78 e dell'art.1, comma 4 del DM 2 nov 2011</div>
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE FARMA 29305-0 or 57833-6 e SPEC 11488-4 or 57832-8-->		
			<!-- START TEMPLATE TIPO DOC EROGATO FARMA 29304-3 -->
			<xsl:when test="$codeDocument='29304-3'">
			<html>
				<head>
					<style type="text/css">/* ============= STILE PER EROGAZIONE FARMACEUTICA ==============*/
						table{border: none;width: 100%;}
						.datatable {border: solid;border-color: #009BCC ;width: 100%;border-width: thin;}
						.tab:link {text-decoration : none;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;color: #000000;font-weight : normal;text-align: left;}
						.tab:visited {text-decoration : none;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;color: #CC3366;font-weight : normal;text-align: left;}
						.tab:hover {text-decoration : underline;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;color: #CC0000;font-weight : normal;text-align: left;background-color: #FFB6C1;}
						.intestazionetabella {color : #FFFFFF;font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : bold;background-color : #009BCC;text-align: left;}
						.intestazionetabellaright {color : #FFFFFF;font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : bold;background-color : #009BCC;text-align: right;}
						.rigapari {background-color : #CCE5FF;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;text-align: left;}
						.rigadispari {background-color : #FFFFFF;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;text-align: left;}
						.rigapariright {background-color : #CCE5FF;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;text-align: right;}
						.rigadispariright {background-color : #FFFFFF;font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;text-align: right;}
						/* STILI PER IL TESTO */h2 {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #FFFFCC;text-align : left;font-size: 1.3em;}
						 h3{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #003366;text-align : left;font-size: 1.2em;}
						h4{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #003366;text-align : left;font-size: 1.1em;}
						 h5.sinistra{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #003366;text-align : left;font-size: 1em;border-width: 1px;border-style: solid;border-color: #336699;padding: 3px;margin-top: -10px;margin-left: 15px;width: auto;background-color: #FFF;position: absolute;/*z-index: auto;*/}
						h5.destra{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #003366;text-align : right;font-size: 1em;border-width: 1px;border-style: solid;border-color: #336699;padding: 3px;margin-top: -10px;margin-left: 15px;width: auto;background-color: #FFF;position: absolute;/*z-index: auto;*/}
						 div#inforiepilogo{line-height: 1em; }
						.riepilogosupbold {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #336699;font-weight : bold;font-size: 0.9em;text-align: left;line-height: 1em;white-space: pre; }
						.riepilogosupboldCVP {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #336699;font-weight : bold;font-size: 0.9em;text-align: left;line-height: 1em;}
						.riepilogosup {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #000;font-size: 0.9em;text-align: left;line-height: 1em; white-space: pre; }
						.riepilogosupCVP {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #000;font-size: 0.9em;text-align: justify;line-height: 1em; }
						.titolosezione {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;color : #336699;font-weight : bold;caption-side: top;text-align: left;}
						.bold{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : bold;}
						 .normalright {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : normal;text-align: right;}
						.normalcenter {font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;font-weight : normal;text-align: center;}
						.alignright {text-align: right;}
						.white {color : #FFFFFF;}
						#nodisplay {display : none;}
						p {line-height: 1.2em;}
						h3 { color: #000; }
						.riepilogosupbold, .intestazionetabella{color:#000;background-color:#FFF;line-height:normal;}
						.datatable{border-color:#000;}
						table{margin-bottom:5px;}
					</style>
				</head>
				<body>
					<div>
						<h3>
							<xsl:call-template name="titolo"/>
						</h3>
						<br/>
						<xsl:if test="boolean(/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value/@codeSystem='2.16.840.1.113883.2.9.5.2.1')">
							<span class="riepilogosupbold">Tipo Erogazione:</span>
							<xsl:choose>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='EF0']">
									<span class="riepilogosup">
										<xsl:text>Erogazione Convenzionata</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='EFC']">
									<span class="riepilogosup">
										<xsl:text>Distribuzione per conto</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='EFD']">
									<span class="riepilogosup">
										<xsl:text>Distribuzione diretta</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='EFA']">
									<span class="riepilogosup">
										<xsl:text>Assistenza integrativa domiciliare</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='EFI']">
									<span class="riepilogosup">
										<xsl:text>Assistenza integrativa</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='ESA']">
									<span class="riepilogosup">
										<xsl:text>Accesso diretto</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='ESP']">
									<span class="riepilogosup">
										<xsl:text>Pronto soccorso</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value[@code='ESD']">
									<span class="riepilogosup">
										<xsl:text>Ricetta specialistica interna</xsl:text>
									</span>
									<br/>
									<br/>
								</xsl:when>
							</xsl:choose>
						</xsl:if>
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="4" class="intestazionetabella">Caratteristiche generali
								documento</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td style="nowrap; width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Livello riservatezza documento: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="getConfidenzialityCode">
												<xsl:with-param name="confidenziality" select="/n1:ClinicalDocument/n1:confidentialityCode"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="riepilogosupbold">
											<xsl:text>Versione documento: </xsl:text>
										</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:choose>
												<xsl:when test="boolean(/n1:ClinicalDocument/n1:versionNumber/@value=1)">
													<xsl:text>ORIGINALE</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>REVISIONE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
								<xsl:for-each select="/n1:ClinicalDocument/n1:relatedDocument">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:call-template name="translateCode">
													<xsl:with-param name="code" select="/n1:ClinicalDocument/n1:relatedDocument/@typeCode"/>
												</xsl:call-template>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:call-template name="relatedDocumentType">
													<xsl:with-param name="parentDocumentID" select="/n1:ClinicalDocument/n1:relatedDocument/n1:parentDocument"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
									<tr>
										<td style="width: 20%">
											<span class="riepilogosupbold">
												<xsl:text>Codice identificativo documento collegato: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosupCVP">
												<xsl:value-of select="/n1:ClinicalDocument/n1:relatedDocument/n1:parentDocument/n1:id/@extension"/>
											</span>
										</td>
									</tr>
								</xsl:for-each>
								<xsl:for-each select="/n1:ClinicalDocument/n1:inFulfillmentOf">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:choose>
													<xsl:when test="contains('28574-2.34105-7', $codeDocument)">
														<xsl:text>Documento accettazione collegato: </xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:if test="boolean(n1:order/n1:id[@root='2.16.840.1.113883.2.9.4.3.6'])">
															<xsl:text>Documento prescrizione collegato (IUP/NRE): </xsl:text>
														</xsl:if>
														<xsl:if test="boolean(n1:order/n1:id[@root='2.16.840.1.113883.2.9.4.3.8'])">
															<xsl:text>Documento prescrizione collegato (NRE): </xsl:text>
														</xsl:if>
													</xsl:otherwise>
												</xsl:choose>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:variable name="iup" select="n1:order/n1:id/@extension"/>
												<xsl:choose>
													<xsl:when test="$iup != ''">
														<xsl:value-of select="$iup"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:text>DATO NON DISPONIBILE</xsl:text>
													</xsl:otherwise>
												</xsl:choose>
											</span>
										</td>
									</tr>
								</xsl:for-each>
								<xsl:choose>
									<xsl:when test="contains('29304-3.34109-9', $codeDocument) or ($tipoCDA = 'ITPRF_EROG_SPEC-001')">
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:id[@root='2.16.840.1.113883.2.9.4.3.6'])">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Codice identificativo Prescrizione cartacea (PLG): </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosup">
														<xsl:value-of select="/n1:ClinicalDocument/n1:setId/@extension"/>
													</span>
												</td>
											</tr>
										</xsl:if>
									</xsl:when>
									<xsl:otherwise>
										<xsl:if test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001')">
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:id[@root='2.16.840.1.113883.2.9.4.3.6'])">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Codice identificativo Prescrizione (IUP): </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:value-of select="/n1:ClinicalDocument/n1:id/@extension"/>
														</span>
													</td>
												</tr>
											</xsl:if>
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:id[@root='2.16.840.1.113883.2.9.4.3.8'])">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Numero ricetta elettronica (NRE): </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:value-of select="/n1:ClinicalDocument/n1:id/@extension"/>
														</span>
													</td>
												</tr>
											</xsl:if>
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:componentOf/n1:encompassingEncounter/n1:code[@codeSystem='2.16.840.1.113883.5.4'])">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Tipologia Visita: </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:choose>
																<xsl:when test="/n1:ClinicalDocument/n1:componentOf/n1:encompassingEncounter/n1:code[@codeSystem='2.16.840.1.113883.5.4']/@code='AMB'">
																	<xsl:text>AMBULATORIALE</xsl:text>
																</xsl:when>
																<xsl:when test="/n1:ClinicalDocument/n1:componentOf/n1:encompassingEncounter/n1:code[@codeSystem='2.16.840.1.113883.5.4']/@code='HH'">
																	<xsl:text>DOMICILIARE</xsl:text>
																</xsl:when>
															</xsl:choose>
														</span>
													</td>
												</tr>
											</xsl:if>
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:code[@code='48767-8']]/n1:text/n1:content/@ID='dispReg')">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Disposizioni Regionali: </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:code[@code='48767-8']]/n1:text/n1:content"/>
														</span>
													</td>
												</tr>
											</xsl:if>
										</xsl:if>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:if test="contains('47039-3.28574-2', $codeDocument)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Codice nososlogico di accettazione: </xsl:text>
											</span>
										</td>
										<td colspan="3">
											<span class="riepilogosup">
												<xsl:value-of select="/n1:ClinicalDocument/n1:setId/@extension"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">Data di creazione del documento:</span>
									</td>
									<td colspan="3">
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</tbody>
						</table>
						<xsl:variable name="nullFlavorID" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@nullFlavor"/>
						<xsl:choose>
							<xsl:when test="$nullFlavorID = 'NA'"/>
							<xsl:otherwise>
								<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
									<thead>
										<tr>
											<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al paziente</th>
										</tr>
									</thead>
									<tbody>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name)">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Assistito: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosupCVP">
														<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
														<xsl:choose>
															<xsl:when test="$nullFlavor='MSK'">
																<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:call-template name="getName">
																	<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
																</xsl:call-template>
															</xsl:otherwise>
														</xsl:choose>
													</span>
												</td>
											</tr>
										</xsl:if>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Codice Fiscale: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/>
												</span>
											</td>
										</tr>
										<xsl:if test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001')">
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20'])">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Numero Tesserino SASN: </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id[@root='2.16.840.1.113883.2.9.4.1.20']/@extension"/>
														</span>
													</td>
												</tr>
											</xsl:if>
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON'])">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Società di Navigazione: </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:value-of select="/n1:ClinicalDocument/n1:participant/n1:associatedEntity[@classCode='CON']/n1:scopingOrganization/n1:name"/>
														</span>
													</td>
												</tr>
											</xsl:if>
											<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[n1:associatedEntity[@classCode='GUAR']]/n1:time)">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Data Scadenza Tessera TEAM: </xsl:text>
														</span>
													</td>
													<td colspan="3">
														<span class="riepilogosup">
															<xsl:call-template name="formatDate">
																<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:participant/n1:time/n1:high/@value"/>
															</xsl:call-template>
														</span>
													</td>
												</tr>
											</xsl:if>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Indirizzo: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosupCVP">
														<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/@nullFlavor"/>
														<xsl:choose>
															<xsl:when test="$nullFlavor='MSK'">
																<xsl:text/>
															</xsl:when>
															<xsl:otherwise>
																<xsl:call-template name="getContactInfo">
																	<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole"/>
																</xsl:call-template>
															</xsl:otherwise>
														</xsl:choose>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Data di nascita: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosup">
														<xsl:call-template name="formatDate">
															<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
														</xsl:call-template>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Luogo di nascita: </xsl:text>
													</span>

												</td>
												<td colspan="3">
													<span class="riepilogosupCVP">
														<xsl:call-template name="getContactInfo">
															<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place"/>
														</xsl:call-template>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode)">
											<tr>
												<td style="width: 20%">
													<span class="riepilogosupbold">
														<xsl:text>Sesso: </xsl:text>
													</span>
												</td>
												<td colspan="3">
													<span class="riepilogosupCVP">
														<xsl:variable name="sex" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/>
														<xsl:choose>
															<xsl:when test="$sex='M'">MASCHIO</xsl:when>
															<xsl:when test="$sex='F'">FEMMINA</xsl:when>
															<xsl:otherwise>
																<xsl:variable name="sex2" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@displayName"/>
																<xsl:choose>
																	<xsl:when test="$sex2='M'">MASCHIO</xsl:when>
																	<xsl:when test="$sex2='F'">FEMMINA</xsl:when>
																	<xsl:otherwise>DATO NON DISPONIBILE</xsl:otherwise>
																</xsl:choose>
															</xsl:otherwise>
														</xsl:choose>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:choose>
											<xsl:when test="contains('34133-9.34878-9', $codeDocument)">
												<xsl:variable name="nullFlavorUNK" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@nullFlavor"/>
												<xsl:choose>
													<xsl:when test="$nullFlavorUNK='UNK'"/>
													<xsl:otherwise>
														<tr>
															<td colspan="4">
																<span class="riepilogosupbold">
																	<xsl:text>Tutore legale dell'assistito: </xsl:text>
																</span>
															</td>
														</tr>
														<tr>
															<td colspan="2">
																<span class="riepilogosupCVP">
																	<xsl:call-template name="getName">
																		<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																	</xsl:call-template>
																	<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																		<br/>
																		<xsl:call-template name="getContactInfo">
																			<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																		</xsl:call-template>
																	</xsl:for-each>
																</span>
															</td>
															<td style="text-align: right; width:25%">
																<span class="riepilogosupbold">
																	<xsl:text>Codice identificativo: </xsl:text>
																</span>
															</td>
															<td>
																<span class="riepilogosup">
																	<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@extension"/>
																</span>
															</td>
														</tr>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:when>
										</xsl:choose>
									</tbody>
								</table>
								<xsl:choose>
									<xsl:when test="contains('28653-4', $codeDocument)">
										<xsl:variable name="nullGuardian" select="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/.)"/>
										<xsl:choose>
											<xsl:when test="$nullGuardian=true"/>
											<xsl:otherwise>
												<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
													<thead>
														<tr>
															<th scope="row" colspan="4" class="intestazionetabella">Reperibilità durante la
													malattia</th>
														</tr>
													</thead>
													<tbody>
														<tr>
															<td style="width:20%">
																<span class="riepilogosupbold">
																	<xsl:text>Nominativo indicato presso l’abitazione: </xsl:text>
																</span>
															</td>
															<td>
																<span class="riepilogosupCVP">
																	<xsl:call-template name="getName">
																		<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																	</xsl:call-template>
																</span>
															</td>
														</tr>
														<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
															<tr>
																<td style="width:20%">
																	<span class="riepilogosupbold">
																		<xsl:text>Indirizzo: </xsl:text>
																	</span>
																</td>
																<td>
																	<span class="riepilogosupCVP">
																		<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																			<xsl:call-template name="getContactInfo">
																				<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																			</xsl:call-template>
																		</xsl:for-each>
																	</span>
																</td>
															</tr>
														</xsl:if>
													</tbody>
												</table>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
								</xsl:choose>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']) and not($tipoCDA = 'ITPRF_SDO_001')">
									<xsl:variable name="existAslPaziente">
										<xsl:choose>
											<xsl:when test="contains('29304-3', $codeDocument)">
												<xsl:choose>
													<xsl:when test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity/n1:scopingOrganization/n1:id)">
														<xsl:value-of select="'SI'"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="'NO'"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="'SI'"/>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:variable>
									<xsl:if test="$existAslPaziente = 'SI'">
										<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
											<thead>
												<tr>
													<th scope="row" colspan="2" class="intestazionetabella">
														<xsl:choose>
															<xsl:when test="contains('34878-9.34133-9', $codeDocument)">
																<xsl:text>Dati relativi ad contatti di parenti riferiti al paziente</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:text>Dati relativi alla ASL di competenza del paziente</xsl:text>
															</xsl:otherwise>
														</xsl:choose>
													</th>
												</tr>
											</thead>
											<tbody>
												<xsl:call-template name="contactTarget"/>
											</tbody>
										</table>
									</xsl:if>
								</xsl:if>
							</xsl:otherwise>
						</xsl:choose>
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="2" class="intestazionetabella">Dati relativi alla struttura
								responsabile della conservazione della registrazione originale</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<!--td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:text>Codice identificativo: </xsl:text>
										</span>
									</td-->
									<td>
										<span class="riepilogosup">
											<xsl:call-template name="ASL_AO_EE_Decode">
												<xsl:with-param name="codice" select="$codeRegione"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name) or (($tipoCDA = 'ITPRF_SDO_001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or $tipoCDA = ('ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001'))">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Struttura sanitaria</xsl:text>
												<br/>
												<xsl:text>(ASL/AO, Studio medico, ecc.): </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:choose>
													<xsl:when test="($tipoCDA = 'ITPRF_SDO_001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001') ">
														<!--CDA DELLA SDO O CDA REF. SPECIALISTICO OR PS OR RICOVERO -->
														<xsl:value-of select="/n1:ClinicalDocument/n1:id/@assigningAuthorityName"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
														<br/>
														<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr)">
															<xsl:call-template name="getContactInfo">
																<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
															</xsl:call-template>
														</xsl:if>
													</xsl:otherwise>
												</xsl:choose>
											</span>
										</td>
									</tr>
								</xsl:if>
							</tbody>
						</table>
						<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC'])">
							<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
								<thead>
									<tr>
										<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
									sostituito</th>
									</tr>
								</thead>
								<tbody>
									<xsl:call-template name="subsituteDoctor"/>
								</tbody>
							</table>
						</xsl:if>
						<xsl:if test="boolean(/n1:ClinicalDocument/n1:informant)">
							<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
								<thead>
									<tr>
										<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
									suggeritore</th>
									</tr>
								</thead>
								<tbody>
									<xsl:call-template name="supportDoctor"/>
								</tbody>
							</table>
						</xsl:if>
						<xsl:for-each select="/n1:ClinicalDocument/n1:componentOf">
							<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
								<thead>
									<tr>
										<th scope="row" colspan="4" class="intestazionetabella">Dati relativi iter
									strutturale della richiesta</th>
									</tr>
								</thead>
								<tbody>
									<xsl:if test="$codeDocument='47039-3'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Data accettazione ricovero: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
													</xsl:call-template>></span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="$tipoCDA='ITPRF_SDO_001'">
										<xsl:variable name="repartoDimissione" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:id/@extension"/>
										<xsl:variable name="repartoAmmissione" select="../n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
										<xsl:variable name="codRiscontroAutoptico" select="n1:encompassingEncounter/n1:code/@code"/>
										<xsl:variable name="codRegime" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:code/@codeSystem"/>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Data accettazione ricovero: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDateGGMMYYYY">
														<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[1]/n1:section/n1:entry[1]/n1:encounter/n1:effectiveTime/n1:low/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>U.O. di accettazione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosupCVP">
													<xsl:text>Specialita' clinica: </xsl:text>
													<xsl:value-of select="substring($repartoAmmissione,1,2)"/>
													<xsl:text> - Prog. reparto: </xsl:text>
													<xsl:value-of select="substring($repartoAmmissione,3,2)"/>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Data dimissione ricovero: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDateGGMMYYYY">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>U.O. di dimissione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosupCVP">
													<xsl:text>Specialita' clinica: </xsl:text>
													<xsl:value-of select="substring($repartoDimissione,1,2)"/>
													<xsl:text> - Prog. reparto: </xsl:text>
													<xsl:value-of select="substring($repartoDimissione,3,2)"/>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Numero Ricovero: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 1,2)"/>
													<xsl:text> - </xsl:text>
													<xsl:value-of select="substring(n1:encompassingEncounter/n1:id/@extension, 3,6)"/>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Regime ricovero: </xsl:text>
												</span>
											</td>											
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:choose>
														<xsl:when test="substring($codRegime,string-length($codRegime))='1'">
															<xsl:text>ORDINARIO</xsl:text>
														</xsl:when>
														<xsl:when test="substring($codRegime,string-length($codRegime))='2'">
															<xsl:text>DAY-HOSPITAL</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:text>DATO NON DISPONIBILE</xsl:text>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Modalita' dimissione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosupCVP">
													<xsl:value-of select="n1:encompassingEncounter/n1:dischargeDispositionCode/@displayName"/>
												</span>
											</td>
										</tr>
										<tr>
											<td>
												<span class="riepilogosupbold">
													<xsl:text>Riscontro autoptico: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:choose>
														<xsl:when test="$codRiscontroAutoptico='1'">
															<xsl:text>SI</xsl:text>
														</xsl:when>
														<xsl:when test="$codRiscontroAutoptico='2'">
															<xsl:text>NO</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:text>DATO NON DISPONIBILE</xsl:text>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td>
										</tr>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:title"/>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosupCVP">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'RICOVERO']/n1:text"/>
												</span>
											</td>
										</tr>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'DIAGNOSI']/n1:title"/>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosupCVP">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'DIAGNOSI']/n1:text"/>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="contains('18748-4.11502-2', $codeDocument)">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Data esecuzione prestazione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="$codeDocument='22034-3'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Codice nosologico: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:value-of select="n1:encompassingEncounter/n1:realmCode/@code"/>
												</span>
											</td>
										</tr>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Tipologia esame</xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="translateCode">
														<xsl:with-param name="code" select="n1:encompassingEncounter/n1:code/@code"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Data prelievo esame: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:low/@value"/>
													</xsl:call-template>
												</span>
											</td>
											<td style="text-align='right'; width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Data esaminazione esame: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/n1:high/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="$codeDocument='28568-4'">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Data accettazione: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:encompassingEncounter/n1:effectiveTime/@value"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Struttura sanitaria</xsl:text>
													<br/>
													<xsl:text>(codifica ministeriale)</xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="getConcatID">
														<xsl:with-param name="root" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@root"/>
														<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:encounterParticipant/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code)">
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Disciplina (reparto)</xsl:text>
													<br/>
													<xsl:text>codifica Ministero della Salute: </xsl:text>
												</span>
											</td>
											<td colspan="3">
												<span class="riepilogosup">
													<xsl:call-template name="getConcatID">
														<xsl:with-param name="root" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@codeSystem"/>
														<xsl:with-param name="extension" select="n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:code/@code"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:if>
								</tbody>
							</table>
							<!--FINE TABELLA -->
						</xsl:for-each>
						<xsl:for-each select="/n1:ClinicalDocument/n1:documentationOf">
							<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
								<xsl:choose>
									<xsl:when test="contains('18748-4.11502-2.22034-3.28568-4', $codeDocument) or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001' )">
										<thead>
											<tr>
												<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al dettaglio
											sulla prestazione eseguita</th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Codice identificativo</xsl:text>
														<br/>
														<xsl:text>(Catalogo Prestazioni Italia): </xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:value-of select="n1:serviceEvent/n1:code/@code"/>
														<!-- <xsl:call-template name="getConcatID"> <xsl:with-param name="root" 
													select="n1:serviceEvent/n1:code/@codeSystem"/> <xsl:with-param name="extension" 
													select="n1:serviceEvent/n1:code/@code"/> </xsl:call-template> -->
													</span>
												</td>
											</tr>
											<xsl:if test="not(n1:serviceEvent/n1:code/@displayName ='')">
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Descrizione della prestazione: </xsl:text>
														</span>
													</td>
													<td>
														<span class="riepilogosup">
															<xsl:value-of select="n1:serviceEvent/n1:code/@displayName"/>
														</span>
													</td>
												</tr>
											</xsl:if>
										</tbody>
									</xsl:when>
									<xsl:when test="$tipoCDA = 'ITPRF_[REFERTO PS]-001' ">
										<thead>
											<tr>
												<th scope="row" colspan="2" class="intestazionetabella">Dati relativi all'episodio
											di emergenza</th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Numero caso:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:value-of select="substring-before(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
														<xsl:text> - </xsl:text>
														<xsl:value-of select="substring('000000',string-length(substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.'))+1)"/>
														<xsl:value-of select="substring-after(/n1:ClinicalDocument/n1:documentationOf/n1:serviceEvent/n1:code/@code, '.')"/>
													</span>
												</td>
											</tr>
										</tbody>
									</xsl:when>
									<xsl:otherwise>
										<xsl:if test="contains('34878-9.34133-9', $codeDocument)">
											<thead>
												<tr>
													<th scope="row" colspan="4" class="intestazionetabella">Dati relativi al periodo
												di riferimento del documento di Patient Summary</th>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Inizio periodo</xsl:text>
															<br/>
															<xsl:text>raccolta dati clinici: </xsl:text>
														</span>
													</td>
													<td>
														<span class="riepilogosup">
															<xsl:choose>
																<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
																	<xsl:text>DATO NON DISPONIBILE</xsl:text>
																</xsl:when>
																<xsl:otherwise>
																	<xsl:call-template name="formatDate">
																		<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:low/@value"/>
																	</xsl:call-template>
																</xsl:otherwise>
															</xsl:choose>
														</span>
													</td>
													<td style="width:20%">
														<span class="riepilogosupbold">
															<xsl:text>Fine periodo</xsl:text>
															<br/>
															<xsl:text>raccolta dati clinici: </xsl:text>
														</span>
													</td>
													<td>
														<span class="riepilogosup">
															<xsl:choose>
																<xsl:when test="boolean(n1:serviceEvent/n1:effectiveTime[@nullFlavor])">
																	<xsl:text>DATO NON DISPONIBILE</xsl:text>
																</xsl:when>
																<xsl:otherwise>
																	<xsl:call-template name="formatDate">
																		<xsl:with-param name="date" select="n1:serviceEvent/n1:effectiveTime/n1:high/@value"/>
																	</xsl:call-template>
																</xsl:otherwise>
															</xsl:choose>
														</span>
													</td>
												</tr>
											</tbody>
										</xsl:if>
									</xsl:otherwise>
								</xsl:choose>
							</table>
						</xsl:for-each>
						<xsl:choose>
							<xsl:when test="($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001')">
								<table class="datatable" width="90%" summary="dati del referto" cellpadding="3" cellspacing="0">
									<thead>
										<tr>
											<th class="intestazionetabella" colspan="2" scope="row">
												<xsl:text>Dati del referto</xsl:text>
											</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td style="width:20%">
												<span class="riepilogosupbold">
													<xsl:text>Categoria:</xsl:text>
												</span>
											</td>
											<td>
												<xsl:variable name="categoria" select="/n1:ClinicalDocument/n1:relatedDocument/@typeCode"/>
												<xsl:choose>
													<xsl:when test="$categoria='RPLC'">
														<span class="riepilogosup">
															<xsl:text>SOSTITUTIVO</xsl:text>
														</span>
													</xsl:when>
													<xsl:when test="$categoria='APND'">
														<span class="riepilogosup">
															<xsl:text>AGGIUNTIVO</xsl:text>
														</span>
													</xsl:when>
													<xsl:otherwise>
														<span class="riepilogosup">
															<xsl:text>NATIVO</xsl:text>
														</span>
													</xsl:otherwise>
												</xsl:choose>
											</td>
										</tr>
										<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='UPDATE NOTE'">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Nota nuovo referto:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosupCVP">
														<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='UPDATE NOTE']/n1:text"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='ASSESSMENT'">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Descrizione:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosupCVP">
														<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ASSESSMENT']/n1:text"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='CONCLUSIONS'">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Conclusioni:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosupCVP">
														<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='CONCLUSIONS']/n1:text"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:title='PHYSICIAN REPORT ATTACHMENT'">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Allegato del corpo:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
													</span>
												</td>
											</tr>
										</xsl:if>
										<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[n1:title='ATTACHMENT']">
											<tr>
												<td style="width:20%">
													<span class="riepilogosupbold">
														<xsl:text>Allegato del referto:</xsl:text>
													</span>
												</td>
												<td>
													<span class="riepilogosup">
														<xsl:value-of select="./n1:entry/n1:observationMedia/n1:value/n1:reference/@value"/>
														<xsl:text> - </xsl:text>
														<xsl:value-of select="./n1:text"/>
													</span>
												</td>
											</tr>
										</xsl:for-each>
									</tbody>
								</table>
							</xsl:when>
							<xsl:otherwise>
								<!--<xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>-->
							</xsl:otherwise>
						</xsl:choose>
						
						
						
						<div>
						<!-- Esenzione -->
							<xsl:variable name="esenzione">
								<xsl:choose>
									<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)">
										<xsl:choose>
											<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text != 'RICETTA NON ESENTE'">
												<xsl:choose>
													<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code)">
														<xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code/@code, ' - ', /n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)"/>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="'RICETTA NON ESENTE'"/>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="'RICETTA NON ESENTE'"/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
						
						<span class="riepilogosupbold">Esenzione (Codifica Regionale): </span> 
						<span class="riepilogosupCVP"><xsl:value-of select="$esenzione"/></span>

						</div>
						
						
						
						<!-- FARMACI EROGATI -->
						<div>

							<xsl:if test="boolean(//n1:section[@ID = 'TICKET'])">
								<br/>
								<span class="riepilogosupbold">
									<xsl:text>Ticket pagato: </xsl:text>
								</span>
								<span class="riepilogosup">
									<xsl:call-template name="string-replace-all">
										<xsl:with-param name="testo" select="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction/n1:amt/@value"/>
										<xsl:with-param name="pattern" select="'.'"/>
										<xsl:with-param name="sostituisci" select="','"/>
									</xsl:call-template>
								</span>
								<br/>
							</xsl:if>
							
							<!-- REDDITO -->
							<br/>
							<span class="riepilogosupbold">Farmaci erogati:</span>
							<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section['EROGAZIONE_FARMACEUTICA']/n1:text/n1:list[@ID = 'EROG']/n1:item">
								<xsl:variable name="indice" select="position()"/>
								<!-- SEZIONE FARMACEUTICA -->
								<table class="datatable" cellspacing="0" cellpadding="3" summary="Farmaci erogati">
									<thead>
										<tr scope="row" colspan="2" class="intestazionetabella">
											<!-- CODICE -->
											<td style="width:20%">
												<span class="intestazionetabella">Codice:</span>
											</td>
											<td>
												<span class="intestazionetabella">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:product/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
												</span>
											</td>
											<td style="width:20%">
												<span class="riepilogosupbold"/>
											</td>
											<td>
												<span class="riepilogosup"/>
											</td>
											<td style="width:20%">
												<span class="riepilogosupbold"/>
											</td>
											<td>
												<span class="riepilogosup"/>
											</td>
										</tr>
									</thead>
									<tbody>
										<tr>
											<!-- DESCRIZIONE -->
											<td style="width:20%">
												<span class="riepilogosupbold">Descrizione:</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:value-of select="n1:content"/>
												</span>
											</td>
										</tr>
										<tr>
											<!-- TARGA -->
											<td style="width:20%">
												<span class="riepilogosupbold">Targa:</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:product/n1:manufacturedProduct/n1:id[@root='2.16.840.1.113883.2.9.4.1.23']/@extension"/>
												</span>
											</td>
										</tr>
										<tr>
											<!-- COD. FARMACO SOST -->
											<td style="width:20%">
												<span class="riepilogosupbold">Cod. Farmaco Sostituito:</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:supply/n1:product/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
												</span>
											</td>
										</tr>
										<tr>
											<!-- MOTIVO SOSTITUZIONE -->
											<td style="width:20%">
												<span class="riepilogosupbold">Motivo Sostituzione:</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:variable name="motivoSostitErog">
														<xsl:choose>
															<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='0'">
																<xsl:text>NON SOSTITUIBILE A CAUSA DELLA PRESENZA IN RICETTA &#xA;DELLA MOTIVAZIONE INDICATA DAL MEDICO O &#xA;DALLA SPECIFICAZIONE DI NON APPLICABILITA' &#xA;DELL'ART. 15, COMMA 11-BIS</xsl:text>
															</xsl:when>
															<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='1'">
																<xsl:text>FARMACO CONTENENTE IL PRINCIPIO ATTIVO INDICATO &#xA;DAL MEDICO IN RICETTA</xsl:text>
															</xsl:when>
															<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='2'">
																<xsl:text>SOSTITUZIONE CON ALTRO FARMACO AVENTE PREZZO INFERIORE</xsl:text>
															</xsl:when>
															<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='3'">
																<xsl:text>FARMACO A PREZZO PIU' BASSO IRREPERIBILE</xsl:text>
															</xsl:when>
														</xsl:choose>
													</xsl:variable>
													<xsl:value-of select="$motivoSostitErog"/>
												</span>
											</td>
										</tr>
										<tr>
											<!-- QUANTITA -->
											<td style="width:20%">
												<span class="riepilogosupbold">Quantita:</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:quantity/@value"/>
												</span>
											</td>
										</tr>
										<tr>
											<!-- PREZZO -->
											<td style="width:20%">
												<span class="riepilogosupbold">Prezzo:</span>
											</td>
											<td>
												<span class="riepilogosup">
													<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.13']]/n1:value/@value"/>
												</span>
											</td>
										</tr>							
									</tbody>
								</table>
							</xsl:for-each>
								
						</div>							
					
					
					
					
							
					
						<xsl:call-template name="bottomline"/>
					</div>
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC EROGATO FARMA 29304-3 -->
			<!-- START TEMPLATE TIPO DOC DOC RELAZIONE PRONTO SOCCORSO 59258-4 -->
			<xsl:when test="$codeDocument='59258-4'">
			<html>
				<head>
					<style type="text/css">
						*{font-family: Verdana, Arial;padding:0;margin:0;font-size: 8pt;}						
						body {  width: 180mm; margin-bottom: 0.5cm; }						
						#tableFooter{ width: 98%;margin:0 auto;margin-top:5px;border-collapse:collapse;border: 0 none; }
						#tableFooter tr td{ padding-top: 40px;}
						#tableFooter tr:last-child td {padding-bottom: 20px; text-align:center;}
						table{text-transform: uppercase;}
						table tr td { /*overflow-wrap: break-word;*/ max-width: 356px;/* word-break: break-all*/}
						table.table_intern {width: 98%;margin:0 auto;margin-top:2px;border-collapse:collapse;border: 1px solid #000;text-transform:none;}
						table.rps_param_vit{width: 100%;font-size: 7pt;}
						table.rps_param_vit td, table.rps_param_vit th{font-size: 7pt;}
					</style>
				</head>
				<body>
					<div>
					<table border="0" style="width: 96%;margin:0 auto;padding-top:20px;">
					  <tbody>
						<tr>
						  <td rowspan="6"><img id="image_logo_regione" alt="" src=""><xsl:attribute name="src"><xsl:value-of select="$logo-location"/></xsl:attribute></img></td>
						  <td colspan="2"><strong>S.I.S.: REGIONE PUGLIA</strong></td>
						</tr>
						<tr>
						  <td><strong>ASL:</strong></td>
						  <td><i><xsl:variable name="laasl">
							<xsl:call-template name="ASL_Decode">
								<xsl:with-param name="codice" select="substring(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@root,25)"/>
							</xsl:call-template>
							</xsl:variable>
							<xsl:if test="string-length($laasl)>0">
								<xsl:text>ASL </xsl:text><xsl:value-of select="$laasl"/>
							</xsl:if>
							</i></td>
						</tr>
							<xsl:variable name="assAutorityNameIntest" select="/n1:ClinicalDocument/n1:setId/@assigningAuthorityName"/>
							<xsl:variable name="nomeIstitutoIntest" select="substring-before($assAutorityNameIntest,'\')"/>		
							<xsl:variable name="stabilimentoIntest" select="substring-after($assAutorityNameIntest,'\')"/>
						<tr>		
						  <td><strong>ISTITUTO:</strong></td>
						  <td><i><xsl:value-of select="$nomeIstitutoIntest"/></i></td>
						</tr>
						<tr>
						  <td><strong>STABILIMENTO</strong>:</td>
						  <td><i><xsl:value-of select="$stabilimentoIntest"/></i></td>
						</tr>
						<tr>
						  <td><strong>PS/PPI:</strong></td>
						  <td><i></i></td>
						</tr>
						<tr>
						  <td><strong>SALA VISITA:</strong></td>
						  <td><i></i></td>
						</tr>
					  </tbody>
					</table>
					<!-- fine intestazione -->
					<!-- inizio titolo -->
					<table border="0"
					style="width: 65%;margin:0 auto;margin-top:20px;border-collapse:collapse;">
					  <tbody>
						<tr>
						  <td
						  style="border: 1px solid #000;font-size: 10pt;letter-spacing: 2pt;padding: 10px;text-align: center;"><strong>RELAZIONE DI PRONTO SOCCORSO</strong></td>
						</tr>
					  </tbody>
					</table>
					<!-- fine titolo -->
					<!-- inizio dati identificativo -->
					<xsl:variable name="setIdExtensionAttr" select="/n1:ClinicalDocument/n1:setId/@extension"/>
					<xsl:variable name="codiceNazionaleIstituto" select="substring-before($setIdExtensionAttr,'.')"/>
					<xsl:variable name="progressivoStabilimento" select="substring-before(substring($setIdExtensionAttr,string-length($codiceNazionaleIstituto)+2),'.')"/>	
					<xsl:variable name="annoAccesso" select="substring-before(substring($setIdExtensionAttr,string-length($progressivoStabilimento)+string-length($codiceNazionaleIstituto)+3),'.')"/>	
					<xsl:variable name="identificativoAccesso" select="substring-after(substring($setIdExtensionAttr,string-length($progressivoStabilimento)+string-length($codiceNazionaleIstituto)+4),'.')"/>	
					<table border="0"
					style="width: 98%;margin:0 auto;margin-top:5px;border-collapse:collapse;border: 1px solid #000;">
					  <tbody>
						<tr>
						  <td><strong>IDENTIFICATIVO ACCESSO:</strong></td>
						  <td><xsl:value-of select="$annoAccesso"/>-<xsl:value-of select="$identificativoAccesso"/></td>
						  <td><strong>ACCETTAZIONE:</strong></td>
						  <td><xsl:call-template name="formatTimestampLong">
								<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:effectiveTime/@value"/>
							</xsl:call-template>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine dati identificativo -->
					<!-- inizio dati assistito -->
					<table border="0" class="table_intern">
					  <tbody>
						<tr>
						  <td><strong>IDENTIFICATIVO:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/></td>
						  <td><strong>ASSISTITO:</strong></td>
						  <td><xsl:value-of select="concat(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/n1:family/text(),' ', /n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/n1:given/text())"/>
						  </td>
						</tr>
						<tr>
						  <td><strong>DATA NASCITA:</strong></td>
						  <td><xsl:call-template name="formatTimestamp">
								<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
							</xsl:call-template></td>
						  <td><strong>NATO/A A:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place/n1:addr/n1:city/text()" /></td>
						</tr>
						<tr>
						  <td><strong>SESSO:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/></td>
						  <td><strong>FASCIA ETA':</strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>CITTADINANZA:</strong></td>
						  <td></td>
						  <td><strong>ASL:</strong></td>
						  <td><xsl:value-of select="concat(//*/n1:scopingOrganization/n1:id[@root='2.16.840.1.113883.2.9.4.1.1']/@extension,' ')"/> <xsl:call-template name="ASL_Decode">
								<xsl:with-param name="codice" select="//*/n1:scopingOrganization/n1:id[@root='2.16.840.1.113883.2.9.4.1.1']/@extension"/>
							</xsl:call-template>
						  </td>
						</tr>
						<tr>
						  <td><strong>RESIDENTE A:</strong></td>
						  <td></td>
						  <td><strong>VIA:</strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>RESIDENZA AGGIORNATA:</strong></td>
						  <td></td>
						  <td><strong>VIA:</strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>DOMICILIO:</strong></td>
						  <td></td>
						  <td><strong>VIA:</strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>DOMICILIO AGGIORNATO:</strong></td>
						  <td></td>
						  <td><strong>VIA:</strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>LIVELLO DI ISTRUZIONE:</strong></td>
						  <td></td>
						  <td></td>
						  <td></td>
						</tr>
					  </tbody>
					</table>
					<!-- fine dati assistito -->
					<!-- inizio dati accompagnatore 
					<xsl:if test="count(/n1:ClinicalDocument/n1:participant[@typeCode='NOT'])>0"> -->
					<table border="0" class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="4"><strong><u><i>DATI ACCOMPAGNATORE</i></u></strong></td>
						</tr>
						<tr>
						  <td><strong>ACCOMPAGNATORE:</strong></td>
						  <td>
							<xsl:if test="/n1:ClinicalDocument/n1:participant[@typeCode='NOT']">
								<xsl:value-of select="/n1:ClinicalDocument/n1:participant[@typeCode='NOT']/n1:associatedEntity/n1:code[@codeSystem='2.16.840.1.113883.12.63']/../n1:id/@extension"/>-<xsl:value-of select="concat(/n1:ClinicalDocument/n1:participant[@typeCode='NOT']/n1:associatedEntity/n1:code[@codeSystem='2.16.840.1.113883.12.63']/../n1:associatedPerson/n1:name/n1:family,' ',/n1:ClinicalDocument/n1:participant[@typeCode='NOT']/n1:associatedEntity/n1:code[@codeSystem='2.16.840.1.113883.12.63']/../n1:associatedPerson/n1:name/n1:given)"/>
							</xsl:if>
							</td>
						  <td><strong>GRADO PARENTELA:</strong></td>
						  <td>	  
						  <xsl:value-of select="/n1:ClinicalDocument/n1:participant[@typeCode='NOT']/n1:associatedEntity/n1:code[@codeSystem='2.16.840.1.113883.12.63']/n1:translation/@displayName"/>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine dati accompagnatore </xsl:if> -->
					<!-- inizio motivo accesso -->
					<table border="0" class="table_intern">
					  <tbody>
						<tr>
						  <td><strong><u><i>MOTIVO DELL'ACCESSO</i></u></strong></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>PROBLEMA PRINCIPALE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.61']/@displayName"/></td>
						</tr>	
						<tr>
						  <td><strong>TRAUMA:</strong></td>
						  <td><xsl:call-template name="motivoAccessoQualifier"/></td>
						</tr>	
						<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:effectiveTime">
						<tr>
						  <td><strong>DATA E ORA EVENTO:</strong></td>
						  <td><xsl:call-template name="formatTimestampLong">
							<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:effectiveTime/@value"/>
						  </xsl:call-template></td>
						</tr>
						</xsl:if>
						<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.61']/../n1:text">
						<tr>
						  <td><strong>DESCRIZIONE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.61']/../n1:text/text()"/></td>
						</tr>
						</xsl:if>
					  </tbody>
					</table>
					<!-- fine motivo accesso -->
					<!-- inizio accettazione -->
					<table border="0" class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="4"><strong><u><i>ACCETTAZIONE</i></u></strong></td>
						</tr>
						<tr>
						  <td><strong>MODALITA' ARRIVO:</strong></td>
						  <td><xsl:call-template name="modoArrivo"/></td>
						  <td><strong>OPERATORE:</strong></td>
						  <td style="display: block; word-break: break-all; max-width: 365px;"><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:addr/n1:unitID/text()"/>-<xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family,' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given)"/></td>
						</tr>
						<tr>
						  <td colspan="4"><strong><u><i>PARAMETRI VITALI DI ACCETTAZIONE</i></u></strong></td>
						</tr>	
						<xsl:choose>
						<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='PARAMETRI_VITALI_ACC'])>0">
						<tr>
						  <td colspan="4">
						  <xsl:variable name="items" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='PARAMETRI_VITALI_ACC']/n1:component"/>	  
						  <table border="0" class="rps_param_vit">
							  <tbody>
							  <xsl:call-template name="rpsParametriVitali">
								<xsl:with-param name="item" select="$items"/>	
								<xsl:with-param name="type" select="PARAMETRI_VITALI_ACC"/>	
								<xsl:with-param name="count" select="count($items)"/>
							  </xsl:call-template>
							</tbody>
						  </table>
						  </td>
						</tr>
						</xsl:when>
						<xsl:otherwise>
						<tr>
						  <td colspan="4"><strong>Dati parametri vitali non acquisisti in fase di accettazione</strong></td>
						</tr>	
						</xsl:otherwise>
						</xsl:choose>
						<tr>
						  <td><strong>TRIAGE DI ACCETTAZIONE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='TRIAGE_A']/n1:code[@codeSystem='2.16.840.1.113883.12.422']/n1:translation/@displayName"/></td>
						  <td><strong>CODICE DI DIMISSIONE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='TRIAGE_D']/n1:code[@codeSystem='2.16.840.1.113883.12.422']/n1:translation/@displayName"/></td>
						</tr>
						<tr>
						  <td><strong>SINTOMATOLOGIA DIAGNOSTICA:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='SINTOMATOLOGIA_DIAGNOSTICA']"/></td>
						  <td></td>
						  <td></td>
						</tr>
						<tr>
						  <td><strong>PERMANENZA IN ACCETTAZIONE:</strong></td>
						  <td>
							<xsl:if test="string-length(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:effectiveTime/@value)>0">
								<xsl:if test="string-length(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:effectiveTime/@value)>0">
								<xsl:call-template name="elapsed-time">
									<xsl:with-param name="start" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ACCETTAZIONE']/n1:entry/n1:encounter/n1:effectiveTime/@value"/>
									<xsl:with-param name="end" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:effectiveTime/@value"/>
								  </xsl:call-template>(hh:mm)
								</xsl:if>
							</xsl:if>
						  </td>
						  <td><strong>ID. REGISTRO CARTACEO:</strong></td>
						  <td></td>
						</tr>
					  </tbody>
					</table>
					<!-- fine accettazione -->
					<!-- inizio presa in visita -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="4"><strong><u><i>PRESA IN VISITA - DATI CLINICI</i></u></strong></td>
						</tr>
						<tr>
						  <td><strong>DATA E ORA:</strong></td>
						  <td><xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:effectiveTime/@value"/></xsl:call-template></td>
						  <td><strong>MEDICO:</strong></td>
						  <td style="display: block; word-break: break-all; max-width: 365px;"><xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:performer/n1:assignedEntity/n1:addr/n1:unitID/text(),'-',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family/text(),' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given/text())"/></td>
						</tr>
						<tr>
						  <td><strong>ANAMNESI:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='ANAMNESI']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>ANAMNESI FARMACOLOGICA:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='ANAM_FARM']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>ALLERGIE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='ALLERGIE']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>IMMUNOPROFILASSI:</strong></td>
						  <td><xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:doseQuantity/@value,' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:doseQuantity/@unit)"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>ALTRE NOTIZIE:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='NOTIZIE']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>ESAME OBIETTIVO:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='ES_OB']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>IPOTESI DIAGNOSTICA:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='IP_DIAGN']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
						<tr>
						  <td><strong>POSTUMI:</strong></td>
						  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:text/n1:list/n1:item[@ID='POSTUMI']/n1:content/text()"/></td>
						  <td> </td>
						  <td> </td>
						</tr>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessuna dato clinico inserito</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine presa in visita -->
					<!-- inizio prestazioni -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="4"><strong><u><i>PRESTAZIONI</i></u></strong></td>
						</tr>
							<xsl:call-template name="ciclaPrestazioniRPS">
								<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE']/n1:entry)"/>
								<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE']/@ID"/>
							</xsl:call-template>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessuna prestazione inserita</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine prestazioni -->
					<!-- inizio farmaci somministrati -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>FARMACI SOMMINISTRATI</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="width: 95%;margin:0 auto;margin-top:2px;border-collapse:collapse;border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>NUM.</strong></td>
								  <td><strong>SOMMINISTRAZIONE</strong></td>
								  <td><strong>FARMACO</strong></td>
								  <td><strong>DOSE/ALTRO</strong></td>
								  <td><strong>QUANTITA'</strong></td>
								  <td><strong>DATA / ORA</strong></td>
								  <td><strong>OPERATORE</strong></td>
								</tr>
								<xsl:call-template name="rpsCiclaFarmaciSomministrati">
									<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI']/n1:entry)" />
									<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI']/@ID"/>
								</xsl:call-template>			
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessun farmaco somministrato</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine farmaci somministrati -->
					<!-- inizio rifiuti -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='RIFIUTI']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>RIFIUTI</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>NUM.</strong></td>
								  <td><strong>TIPOLOGIA</strong></td>
								  <td><strong>DESCRIZIONE</strong></td>
								  <td><strong>DATA / ORA</strong></td>
								</tr>
								<xsl:call-template name="rpsCiclaRifiuti">
									<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='RIFIUTI']/n1:entry)"/>
								</xsl:call-template>
								<tr>
								  <td></td>
								  <td colspan="3">FIRMA PAZIENTE/ACCOMPAGNATORE/DICHIARANTE
									______________________________________________ </td>
								</tr>
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine rifiuti -->
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessun rifiuto inserito</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- inizio diario rilevazioni parametri vitali -->
					<xsl:choose>
					<xsl:when test="count(//n1:section[@ID='PARAMETRI_VITALI']/n1:component)>0">
					<table border="0" class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="4"><strong><u><i>DIARIO RILEVAZIONI PARAMETRI VITALI</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="4"><strong><u><i></i></u></strong></td>
						</tr>
						<tr>
							<td colspan="4">
							<table border="0" class="rps_param_vit">
							  <tbody>
								<xsl:variable name="items" select="//n1:section[@ID='PARAMETRI_VITALI']/n1:component"/>
								<xsl:variable name="type" select="//n1:section[@ID='PARAMETRI_VITALI']/@ID"/>
								<xsl:call-template name="rpsParametriVitali">
									<xsl:with-param name="item" select="$items"/>
									<xsl:with-param name="type" select="$type"/>
									<xsl:with-param name="count" select="count($items)"/>
								</xsl:call-template>
								</tbody>
							</table>
							</td>			
						</tr>    
					  </tbody>
					  </table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessuna rilevazione di parametri vitali è presente nel diario</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					<!-- fine diario rilevazioni parametri vitali -->
					</xsl:choose>
					<!-- inizio diario clinico -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>DIARIO CLINICO</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>NUM.</strong></td>
								  <td><strong>DATA</strong></td>
								  <td><strong>DESCRIZIONE</strong></td>
								  <td><strong>OPERATORE</strong></td>
								</tr>
								<xsl:call-template name="ciclaDiarioRPS">
									<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO']/n1:entry)"/>
									<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO']/@ID"/>
								</xsl:call-template>
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessun diario clinco acquisito</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine diario clinico -->
					<!-- inizio fratture -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FRATTURE']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>FRATTURE DA FRAGILITA'</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>NUM.</strong></td>
								  <td><strong>DATA</strong></td>
								  <td><strong>DESCRIZIONE</strong></td>
								  <td><strong>OPERATORE</strong></td>
								</tr>
								<xsl:call-template name="ciclaFrattureRPS">
									<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FRATTURE']/n1:entry)"/>
								</xsl:call-template>
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessuna frattura da fragilità rilevata</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine fratture -->
					<!-- inizio diario clinico -->
					<xsl:if test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:text/n1:content)>0">
					<xsl:variable name="obcount" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry)"/>
					<xsl:variable name="OBICode" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry[$obcount]/n1:act/n1:code/@code"/>
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>OSSERVAZIONE BREVE</i></u></strong></td>
						</tr>
						<tr>	
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>DATA E ORA INIZIO:</strong></td>
								  <td><xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry[1]/n1:act/n1:effectiveTime/n1:low/@value"/></xsl:call-template></td>
								  <td><strong>DATA E ORA FINE:</strong></td>
								  <td><xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry[$obcount]/n1:act/n1:effectiveTime/n1:high/@value"/></xsl:call-template></td>
								</tr>
								<tr>
								  <td><strong>MOTIVO:</strong></td>
								  <td><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:text/n1:content"/></td>
								  <td></td>
								  <td></td>
								</tr>
								<tr>
								  <td><strong>TIPO:</strong></td>
								  <td><xsl:choose>
											<xsl:when test="$OBICode='1'">OT - OSSERVAZIONE TEMPORANEA (PERMANENZA FINO A 6 ORE)</xsl:when>
											<xsl:when test="$OBICode='2'">OB - Osservazione Breve</xsl:when>
											<xsl:when test="$OBICode='3'">MUSI - Medicina d'Urgenza - Subintensiva</xsl:when>
										</xsl:choose>
								  </td>
								  <td><strong>DATA E ORA PASSAGGIO:</strong></td>
								  <td>
									<xsl:if test="$obcount=2">
										<xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry[2]/n1:act/n1:effectiveTime/n1:low/@value"/></xsl:call-template>
									</xsl:if>
								  </td>
								</tr>
								<!-- prestazioni in OB -->
								<xsl:choose>
									<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE_OB']/@ID='PRESTAZIONI_EROGATE_OB'">
										<tr>
											<td colspan="4"><strong><u><i>PRESTAZIONI EROGATE DURANTE L'OSSERVAZIONE BREVE</i></u></strong></td>	              		
										</tr>
										<xsl:call-template name="ciclaPrestazioniRPS">
											<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE_OB']/n1:entry)"/>
											<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESTAZIONI_EROGATE_OB']/@ID"/>
										</xsl:call-template>
									</xsl:when>
									<xsl:otherwise>			
									<tr>
									  <td colspan="4">Nessuna prestazione è stata erogata</td>              
									</tr>
									</xsl:otherwise>
								</xsl:choose>
								<!-- fine prestazioni in OB -->
								<!-- inizio diario rilevazioni parametri vitali OB -->
								<xsl:choose>
								<xsl:when test="count(//n1:section[@ID='PARAMETRI_VITALI_OB']/n1:component)>0">				    
									<tr>
									  <td colspan="4"><strong><u><i></i></u></strong></td>
									</tr>
									<tr>
										<td colspan="4"><strong><u><i>DIARIO RILEVAZIONI PARAMETRI VITALI EFFETTUATE DURANTE L'OSSERVAZIONE BREVE</i></u></strong></td>	              		
									</tr>
									<tr>
									  <td colspan="4"><strong><u><i></i></u></strong></td>
									</tr>

									<tr>
										<td colspan="4">
										<xsl:variable name="items" select="//n1:section[@ID='PARAMETRI_VITALI_OB']/n1:component"/>
										<xsl:variable name="type" select="//n1:section[@ID='PARAMETRI_VITALI_OB']/@ID"/>
										<table border="0" class="rps_param_vit">
										<tbody>
										<xsl:call-template name="rpsParametriVitali">
											<xsl:with-param name="item" select="$items"/>
											<xsl:with-param name="type" select="$type"/>
											<xsl:with-param name="count" select="count($items)"/>
										</xsl:call-template>
										</tbody>
										</table>
										</td>			
									</tr>    			  
								</xsl:when>
								<xsl:otherwise>				
									<tr>
										<td colspan="1"><strong>Nessuna rilevazione di parametri vitali è stata effettuata</strong></td>
									</tr>					
								</xsl:otherwise>			
								</xsl:choose>	
								<!-- fine diario rilevazioni parametri vitali OB -->			
								<!-- inizio diario clinico OB-->
								<xsl:choose>
								<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO_OB']/n1:entry)>0">			
									<tr>
									  <td colspan="4"><strong><u><i></i></u></strong></td>
									</tr>
									<tr>
									  <td colspan="4"><strong><u><i>DIARIO CLINICO DELLE RILEVAZIONI EFFETTUATE DURANTE L'OSSERVAZIONE BREVE</i></u></strong></td>
									</tr>
									<tr>
									  <td colspan="4">
										<table border="0"
										style="border: 0 none;">
										  <tbody>
											<tr>
											  <td><strong>NUM.</strong></td>
											  <td><strong>DATA</strong></td>
											  <td><strong>DESCRIZIONE</strong></td>
											  <td><strong>OPERATORE</strong></td>
											</tr>
											<xsl:call-template name="ciclaDiarioRPS">
												<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO_OB']/n1:entry)"/>
												<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIARIO_CLINICO_OB']/@ID"/>
											</xsl:call-template>
										  </tbody>
										</table>
									  </td>
									</tr>
								</xsl:when>
								<xsl:otherwise>				
									<tr>
										<td colspan="4">Nessun diario clinico acquisito</td>
									</tr>					
								</xsl:otherwise>
								</xsl:choose>
								<!-- fine diario clinico OB-->
								<!-- inizio farmaci somministrati OB -->
								<xsl:choose>
								<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI_OB']/n1:entry)>0">
									<tr>
									  <td colspan="4"><strong><u><i></i></u></strong></td>
									</tr>
									<tr>
									  <td colspan="4"><strong><u><i>FARMACI SOMMINISTRATI DURANTE L'OSSERVAZIONE BREVE</i></u></strong></td>
									</tr>
									<tr>
									  <td colspan="4">
										<table border="0"
										style="width: 95%;margin:0 auto;margin-top:2px;border-collapse:collapse;border: 0 none;">
										  <tbody>
											<tr>
											  <td><strong>NUM.</strong></td>
											  <td><strong>SOMMINISTRAZIONE</strong></td>
											  <td><strong>FARMACO</strong></td>
											  <td><strong>DOSE/ALTRO</strong></td>
											  <td><strong>QUANTITA'</strong></td>
											  <td><strong>DATA / ORA</strong></td>
											  <td><strong>OPERATORE</strong></td>
											</tr>
											<xsl:call-template name="rpsCiclaFarmaciSomministrati">
												<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI_OB']/n1:entry)" />
												<xsl:with-param name="type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FARMACI_SOMMINISTRATI_OB']/@ID"/>
											</xsl:call-template>			
										  </tbody>
										</table>
									  </td>
									</tr>
								</xsl:when>
								<xsl:otherwise>				
									<tr>
										<td colspan="4">Nessun farmaco somministrato</td>
									</tr>					
								</xsl:otherwise>
								</xsl:choose>
								<!-- fine farmaci somministrati OB -->            
								<tr>              
								  <xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='OBI']/n1:entry">
									<xsl:choose>
										<xsl:when test="./n1:act/n1:code/@code='2'">
											<td><strong>PERMANENZA IN OB:</strong></td>
										</xsl:when>
										<xsl:when test="./n1:act/n1:code/@code='1'">
											<td><strong>PERMANENZA IN OT:</strong></td>
										</xsl:when>
										<xsl:when test="./n1:act/n1:code/@code='3'">
											<td><strong>PERMANENZA IN MUSI:</strong></td>
										</xsl:when>
									</xsl:choose>					
									<xsl:choose>
									<xsl:when test="./n1:act/n1:effectiveTime/n1:low and ./n1:act/n1:effectiveTime/n1:high">
										<td>
										<xsl:call-template name="elapsed-time">
											<xsl:with-param name="start" select="./n1:act/n1:effectiveTime/n1:low/@value"/>
											<xsl:with-param name="end" select="./n1:act/n1:effectiveTime/n1:high/@value"/>
										</xsl:call-template>
										(hh:mm)
										</td>
									</xsl:when>
									<xsl:otherwise>
										<td>00:00(hh:mm)</td>							
									</xsl:otherwise>
									</xsl:choose>				  					 
								</xsl:for-each>
								</tr>
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine osservazione breve -->
					</xsl:if>
					<!-- inizio dimissione -->
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>DIMISSIONE</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>MODALITA':</strong></td>
								  <td colspan="2">
								  <xsl:variable name="codeMod" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/@code"/>
									<xsl:choose>
										<xsl:when test="$codeMod='1'">Dimissione a domicilio con affidamento al medico curante</xsl:when>
										<xsl:when test="$codeMod='22'">Ricovero in reparto di degenza su richiesta del reparto</xsl:when>
										<xsl:when test="$codeMod='21'">Ricovero in reparto di degenza su consiglio del consulente</xsl:when>
										<xsl:when test="$codeMod='2'">Ricovero in reparto di degenza</xsl:when>
										<xsl:when test="$codeMod='3'">Trasferimento ad altro istituto</xsl:when>
										<xsl:when test="$codeMod='4'">Deceduto in PS</xsl:when>
										<xsl:when test="$codeMod='51'">Rifiuta ricovero nello stesso istituto</xsl:when>
										<xsl:when test="$codeMod='5'">Rifiuta ricovero in latro istituto</xsl:when>
										<xsl:when test="$codeMod='6'">Il paziente abbandona il Pronto Soccorso prima della visita medica</xsl:when>
										<xsl:when test="$codeMod='7'">Il paziente abbandona il Pronto Soccorso in corso di accertamenti e/o prima della chiusura della cartella clinica</xsl:when>
										<xsl:when test="$codeMod='8'">Dimissione a strutture ambulatoriali</xsl:when>
										<xsl:when test="$codeMod='9'">Giunto cadavere</xsl:when>					
									</xsl:choose>
								  </td>
								  <td><strong></strong></td>
								  <td style="text-align:center"><strong>DATA E ORA:</strong></td>
								  <td>			  	
									<xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:effectiveTime/@value"/></xsl:call-template>
								  </td>
								  <td></td>
								</tr>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/@code='4'">
								<tr>
									<td><strong>DATA DECESSO:</strong></td>
									<td colspan="3">
										<xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:code[@code='81956-5']/../n1:effectiveTime/@value"/></xsl:call-template>
									</td>
								</tr>
								</xsl:if>
								<tr>
								  <td><strong>COMUNICAZIONE PRODOTTA PER:</strong></td>
								  <td colspan="2">
									<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.59']/@displayName"/>					
								  </td>
								  <td></td>
								  <td></td>
								  <td></td>
								  <td></td>
								</tr>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:entryRelationship/n1:observation/n1:code[@code='48767-8'] or /n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:entryRelationship/n1:observation/n1:code[@code='45477-7']">
									<tr>
									  <td><strong>A DISPOSIZIONE DELL'AUTORITA' GIUDIZIARIA:</strong></td>
									  <td>
									  <xsl:choose>
										  <xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:entryRelationship/n1:observation/n1:code[@code='48767-8']">SI</xsl:when>
										  <xsl:otherwise>NO</xsl:otherwise>
									  </xsl:choose>
									  </td>
									  <xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/@code='4'">
									  <td><strong>RICHIESTA AUTOPSIA:</strong></td>
									  <td>
										  <xsl:choose>
										  <xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:entryRelationship/n1:observation/n1:code[@code='45477-7']/../n1:value/@value='true'">SI</xsl:when>
										  <xsl:otherwise>NO</xsl:otherwise>
										  </xsl:choose>
									  </td>
									  </xsl:if>
									  <td></td>
									  <td></td>
									  <td></td>
								</tr>
								</xsl:if>	
								<tr>
								  <td><strong>PARTECIPAZIONE ALLA SPESA:</strong></td>
								  <td>
									<xsl:variable name="entrySpesa" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:act/n1:code[@codeSystem='2.16.840.1.133883.18.263']/@code"/>
										<xsl:choose>
											<xsl:when test="$entrySpesa='1'">non urgente</xsl:when>
											<xsl:when test="$entrySpesa='3'">urgente</xsl:when>						
											<xsl:otherwise></xsl:otherwise>
										</xsl:choose>
								  </td>
								  <td><strong>PROGNOSI RISERVATA:</strong></td>
								  <td>
								  <xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:act/n1:code[@code='48767-8']/../n1:entryRelationship/n1:observation/n1:code[@code='PR']">	
										<xsl:variable name="progn_ris" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:act/n1:code[@code='48767-8']/../n1:entryRelationship/n1:observation/n1:code[@code='PR']/../n1:value/@value"/>
										<xsl:choose>
											<xsl:when test="$progn_ris='true'">SI</xsl:when>
											<xsl:otherwise>NO</xsl:otherwise>
										</xsl:choose>
								  </xsl:if>
								  </td>
								  <td style="text-align:center"><strong>NR. GG. PROGNOSI:</strong></td>
								  <td><xsl:if test="//n1:section[@ID='DIMISSIONE']//*/n1:observation/n1:code[@code='46524-5']/../n1:value/@value">
										<xsl:value-of select="concat(//n1:section[@ID='DIMISSIONE']//*/n1:observation/n1:code[@code='46524-5']/../n1:value/@value,' S.C.')"/>
									</xsl:if>
								  </td>
								  <td></td>
								</tr>
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:text/n1:list/n1:item[@ID='TERAPIA_DOMICILIARE_PRESCRIZIONE']/n1:content/text()">
								<tr>
								  <td colspan="2"><strong>TERAPIA DOMICILIARE / PRESTAZIONI:
									</strong></td>
								  <td colspan="4">			  	
									<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:text/n1:list/n1:item[@ID='TERAPIA_DOMICILIARE_PRESCRIZIONE']/n1:content"/></td>
								  <td></td>
								</tr>
								</xsl:if>
								<tr>
								  <td colspan="2"><strong>PERMANENZA IN ASSISTENZA:</strong></td>
								  <td colspan="4">
									<xsl:if test="string-length(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:effectiveTime/@value)>0">
										<xsl:if test="string-length(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:effectiveTime/@value)>0">
										<xsl:call-template name="elapsed-time">
										<xsl:with-param name="start" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DATI_CLINICI']/n1:entry/n1:substanceAdministration/n1:effectiveTime/@value"/>
										<xsl:with-param name="end" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:effectiveTime/@value"/>
									  </xsl:call-template>(hh:mm)
									  </xsl:if>
									</xsl:if>
								  </td>
								  <td></td>
								</tr>
								<tr>
								  <td colspan="2"><strong>DIAGNOSI DI DIMISSIONE:</strong></td>
								  <td colspan="4"><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:observation/n1:code[@codeSystem='2.16.840.1.113883.6.103']/@displayName"/></td>
								  <td></td>
								</tr>
								<tr>
								  <td colspan="2"><strong>DESCRIZIONE AGGIUNTIVA:</strong></td>
								  <td colspan="4"><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:text/n1:list/n1:item[@ID='DIAGNOSI_PRINCIPALE_AGGIUNTIVA']/n1:content"/></td>
								  <td></td>
								</tr>
								<!-- inizio diagnosi secondarie -->
								<xsl:choose>
								<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:component/n1:section[@ID='DIAGNOSI_SECONDARIE']">
									<tr>
										<td colspan="3"><strong><i><u>DIAGNOSI SECONDARIE</u></i></strong></td>					
									</tr>
									<tr>
										<td><strong>NUM.</strong></td>
										<td><strong>DIAGNOSI</strong></td>
										<td><strong>DESCRIZIONE AGGIUNTIVA</strong></td>
									</tr>				
									<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:component/n1:section[@ID='DIAGNOSI_SECONDARIE']/n1:entry">
									<xsl:variable name="count" select="position()" />
									<tr>	
										<td><xsl:value-of select="$count"/></td>				
										<td>
											<xsl:value-of select="n1:observation/n1:code/@displayName" />
										</td>
										<td><xsl:value-of select="n1:observation/n1:text/text()" /></td>
									</tr>				
									</xsl:for-each>
								</xsl:when>
									<xsl:otherwise>
										<tr>
											<td style="text-transform:none" colspan="4">
												<strong>Nessuna diagnosi secondaria inserita</strong>
											</td>
										</tr>
									</xsl:otherwise>
								</xsl:choose>
								<!-- fine diagnosi secondarie -->
								<!-- inizio ricovero -->
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/@code='2'">
									<tr>
										<td><strong>RICOVERO</strong></td>
									</tr>
									<tr>
										<td colspan="1"><strong>REPARTO:</strong></td>
										<td colspan="2">
											<xsl:variable name="allRic" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:entryRelationship/n1:encounter/n1:participant/n1:participantRole/n1:scopingEntity/n1:desc/text()"/>
						<xsl:variable name="istitutoRic" select="substring-before($allRic,'\')"/>
						<xsl:variable name="stabilimentoRic" select="substring-before(substring($allRic,string-length($istitutoRic)+2),'\')"/>	
						<xsl:variable name="repartoRic" select="substring-after(substring($allRic,string-length($istitutoRic)+2),'\')"/>	
						<xsl:value-of select="$repartoRic"/>
										</td>
										<td colspan="4"><strong>ID.SDO:</strong>
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:entryRelationship/n1:encounter/n1:participant/n1:participantRole/n1:scopingEntity/n1:id/@extension"/>
										<xsl:text> </xsl:text>
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:entryRelationship/n1:encounter/n1:participant/n1:participantRole/n1:id/@extension"/>
										</td>
									</tr>
								</xsl:if>
								<!-- fine ricovero -->
								<!-- inizio trasferimento -->
								<xsl:if test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/@code='3'">
									<tr>
										<td><strong>TRASFERIMENTO</strong></td>
									</tr>
									<tr>
										<td colspan="1"><strong>MOTIVO:</strong></td>
										<td colspan="4"><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:entryRelationship/n1:encounter/n1:code/@displayName"/></td>
									</tr>
									<tr>
										<td colspan="1"><strong>IN REGIONE:</strong></td>					
										<td colspan="2">
											<xsl:variable name="allTransf" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:entry/n1:encounter/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.82']/../n1:entryRelationship/n1:encounter/n1:participant/n1:participantRole/n1:scopingEntity/n1:desc/text()"/>
						<xsl:variable name="istitutoTransf" select="substring-before($allTransf,'\')"/>
						<xsl:variable name="stabilimentoTransf" select="substring-before(substring($allTransf,string-length($istitutoTransf)+2),'\')"/>	
						<xsl:variable name="repartoTransf" select="substring-after(substring($allTransf,string-length($istitutoTransf)+2),'\')"/>	
						<xsl:value-of select="concat($istitutoTransf,'*',$stabilimentoTransf,'*',$repartoTransf)"/>
										</td>
									</tr>
								</xsl:if>
								<!-- fine trasferimento  -->
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine dimissione -->
					<!-- inizio dichiarazioni -->
					<xsl:choose>
					<xsl:when test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry)>0">
					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>DICHIARAZIONI</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>NUM.</strong></td>
								  <td><strong>DATA</strong></td>
								  <td><strong>DICHIARAZIONE</strong></td>
								  <td><strong>OPERATORE</strong></td>
								</tr>
								<xsl:call-template name="rpsCiclaRifiutiDichiarazioni">
									<xsl:with-param name="count" select="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry)"/>
								</xsl:call-template>           
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					</xsl:when>
					<xsl:otherwise>
						<table border="0" class="table_intern">
							<tbody>
								<tr>
									<td colspan="1"><strong>Nessuna dichiarazione assistito è stata registrata</strong></td>
								</tr>
							</tbody>
						</table>
					</xsl:otherwise>
					</xsl:choose>
					<!-- fine dichiarazioni -->
					<!-- inizio operatori -->

					<table border="0"
					class="table_intern">
					  <tbody>
						<tr>
						  <td colspan="1"><strong><u><i>OPERATORI</i></u></strong></td>
						</tr>
						<tr>
						  <td colspan="1">
							<table border="0"
							style="border: 0 none;">
							  <tbody>
								<tr>
								  <td><strong>OPERATORE</strong>-<strong>TIPO</strong></td>
								  <td><strong>DATA E ORA</strong></td>
								  <td><strong>CAMBIO TURNO</strong></td>
								</tr>			
								<tr>
								  <td colspan="1">
									<xsl:value-of select="//*/n1:section[@ID='ATTIVITA_OPERATORI']/n1:text/n1:content/text()"/>
								  </td>
								   <td colspan="2"></td>
								</tr>
							  </tbody>
							</table>
						  </td>
						</tr>
					  </tbody>
					</table>
					<!-- fine operatori -->
					<!-- inizio altre notizie -->
					<table border="0" id="tableFooter">
					  <tbody>
						<tr>      
						  <td colspan="4"><strong>ALTRE NOTIZIE:</strong><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:text/n1:list/n1:item[@ID='ALTRE_NOTIZIE']/n1:content"/></td>      
						</tr>    
						<tr>      
						  <td colspan="4"><strong>NOTE:</strong><xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIMISSIONE']/n1:text/n1:list/n1:item[@ID='NOTE']/n1:content"/></td>    
						</tr>
						<tr>
						  <td colspan="2"><strong>FIRMA PAZIENTE/ACCOMPAGNATORE/DICHIARANTE</strong></td>
						  <td colspan="2" style="text-align:center"><strong>IL MEDICO</strong></td>      
						</tr>
						<tr>
						  <td colspan="2">_____________________________________________</td>
						  <td colspan="2" style="text-align:center;display:block; word-break: break-all;"><xsl:value-of select="concat(/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name/n1:family/text(),' ',/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name/n1:given/text())"/></td>      
						</tr>   
					  </tbody>
					</table>
					<!-- fine operatori -->
					</div>
				</body>
			</html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC RELAZIONE PRONTO SOCCORSO 34111-5 -->
			<!-- START TEMPLATE TIPO DOC DOC ATTESTATO VACCINAZIONE 11369-5-->
			<xsl:when test="$codeDocument='11369-6'">
			<html>
				<head>
					<style type="text/css">
						*{font-family: Verdana, Arial; padding:0;margin:0; }
						@page { size: 210mm 297mm; margin: 5mm }
						@media print { body { background: white; box-shadow: none; width: 200mm; height: 286.5mm; font-size: 84%; font-family: Tahoma, Geneva, Arial, Helvetica, sans-serif; }}
						body { font-size: 14px; background: white; width: 200mm; margin-bottom: 0.5cm; box-shadow: 0 0 0.5cm rgba(0, 0, 0, 0.5); cursor: default; background-position: top-left; background-repeat: no-repeat;}
						table {font-size: 14px;} 
						 .table_w_borders{width: 98%;margin:0 auto;margin-top:20px;border-collapse:collapse;border-left: 1px solid #000;border-top: 1px solid #000;}
						 .table_w_borders td{border-right: 1px solid #000;border-bottom: 1px solid #000;}
						 .cell_w_borders tr{border-left: 1px solid #000;border-top: 1px solid #000;}
						 .cell_w_borders td{border-right: 1px solid #000;border-bottom: 1px solid #000;}
						 td {padding: 2px;}
					</style>
				</head>
				<body>
					<div>
					<!-- inizio intestazione -->
					<table border="0" style="width: 96%;margin:0 auto;padding-top:20px;">
					  <tbody>
					    <tr>
					      <td rowspan="4"><img id="image_logo_regione" alt="" src="data:image/png;base64,[encoded data, 6044 characters]"/></td>
					      <td><strong>S.I.S.: REGIONE PUGLIA</strong></td>
					    </tr>
					    <tr>
					      <td><strong>DIPARTIMENTO DI PREVENZIONE</strong></td>
					    </tr>
					    <tr>
					      <td>Servizio di Igiene e Sanita' Pubblica</td>
					    </tr>
					    <tr>
					      <td><xsl:call-template name="ASL_AO_EE_Decode"><xsl:with-param name="codice" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/></xsl:call-template></td>
					    </tr>
					  </tbody>
					</table>
					<!-- fine intestazione -->
					<!-- inizio titolo -->
					<table border="0"
					style="width: 85%;margin:0 auto;margin-top:20px;border-collapse:collapse;border: 1px solid #000;">
					  <tbody>
					    <tr>
					      <td colspan="6"
					      style="font-size: 16px;letter-spacing: 3px;padding: 5px;text-align: center;"><strong>Attestato
					        di vaccinazione</strong></td>
					    </tr>
					  </tbody>
					</table>
					<!-- fine titolo -->

					<div style="width: 85%;margin:0 auto;margin-top:20px;border-collapse:collapse;">
					  <span><em>Data</em>:<em><xsl:call-template name="formatTimestamp"><xsl:with-param name="date" select="/n1:ClinicalDocument/n1:effectiveTime/@value"/></xsl:call-template></em></span>      
					</div>
					<!-- inizio dati assistito -->
					<table class="table_w_borders" border="0" style="">
					  <tbody>
					    <tr>
					      <td>Si certifica che:</td>
					      <td colspan="2"><xsl:value-of select="concat(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/n1:family/text(),' ', /n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/n1:given/text())"/></td>
					      <td>C.F.:</td>
					      <td colspan="2"><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension"/></td>
					    </tr>
					    <tr>
					      <td>nato/a a:</td>
					      <td colspan="2">	  	
						  	<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place/n1:addr/n1:city"/>
						  </td>
					      <td>il:</td>
					      <td colspan="2"><xsl:call-template name="formatTimestamp">
													<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
												</xsl:call-template></td>
					    </tr>
					    <tr>
					      <td>residente a:</td>
					      <td colspan="2"><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:city"/></td>
					      <td>provincia:</td>
					      <td colspan="2"><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:county"/></td>
					    </tr>
					    <tr>
					      <td>in:</td>
					      <td colspan="5"><xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/n1:streetName"/></td>
					    </tr>
					  </tbody>
					</table>

					<div style="width: 85%;margin:0 auto;margin-top:20px;border-collapse:collapse;">
					  <span>ha ricevuto le seguenti vaccinazioni:</span>      
					</div>
					<xsl:variable name="thead" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:text/n1:table/n1:thead" />
					<xsl:variable name="tcontent" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:text/n1:table/n1:tbody" />

					<table border="1" class="" style="width: 88%;margin:0 auto; border-collapse:collapse;margin-top:20px;margin-bottom:50px;">
					<xsl:copy-of select="$thead"/>
					<xsl:copy-of select="$tcontent"/>
					</table>

					<table border="0"
					style="width: 88%;margin:0 auto;margin-top:2px;border-collapse:collapse;border: 0 none;">
					  <tbody>
					    <tr>
					      <td colspan="6"><strong>Il medico responsabile: 
					        <xsl:value-of select="concat(/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name/n1:given,' ',/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:assignedPerson/n1:name/n1:family)"/></strong></td>
					    </tr>    
					  </tbody>
					</table>

					<table class="table_w_borders" style="font-size:10px; margin-bottom:50px;">
					  <tbody>
					    <tr class="cell_w_borders">
					      <td>D = Difterite</td>
					      <td>T = Tetano</td>
					      <td>P = Pertosse</td>
					      <td>HBV = Epatite B</td>
					      <td>MPR = Morbillo-Parotite-Rosolia</td>
					      <td>V = Varicella</td>
					    </tr>
					    <tr class="cell_w_borders">
					      <td>IPV = Polio iniettabile</td>
					      <td>OPV = Polio orale</td>
					      <td>aP = Pertosse/Acellulare</td>
					      <td>Pneumo = Pneumococco</td>
					      <td>HIB = Haemophilus influenzae tipo B</td>
					      <td>HPV = Papillomavirus</td>
					    </tr>
					  </tbody>
					</table>
					<p>&#160;</p>
					<div style="text-align:center"><p>
						<img align="center" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAAOUSURBVFhHvZc7aBRBGMfPV3y/IxaKoKSwEAOmkIgmYHIh5m4vKRJIIQoWAQtBLUQbz8ZXEh8RWys1wU4sRGvFQtDKR6MJohIMiiCIChH9/Tczy7jOjndELX4333z7zXz/2fl2di9XLpdn9vT0zFJrbcu/9uVyuRk5Gc3NzbMFdk1bW9sKl66urpUhH+MW2fHVEouQInVKpVJrFBXfRFH0oxqKxeIkXIUF6QR/IhHQ0NAwh8leMcl4oVA4hz2APegS8H0yQkZ0B32JsogF6IfVL9YkJB/yBYbgro1rrBl/WYvxxfnQ4mMB7e3tS8wqLvgCQzAuEWDmOO6L8+ETcNEXGCItQHAn9vti08RbIBV/WwDzTCKi2xfvkghobW1dagZWLYBED9ICpihOkCApStUG86/r6+tLaiQWMN0tYOxc94xoaWlZyVxDmk/nhWKw1zP3/Slh0T0VvfzBImRla6bOhigvZONTfydxwWeemH5iJszTVYc9RpvcHebpVVywCLFvuINcmGCPjfPB9SNQT+xvyeGr/IqLtyCrCOmvZgVNgsl2iI6OjiZitnN9no3zwcQ1SpJOTl/FmYhPBEynCH1kJP8OX+AQ/Uf5fH5hLCBrC1S1nZ2dyywoX+720z6tOpB8slQq7MMeMP1Tig0WIf3z8lXIZ7ZnG21mcsQ2YH+IosJpe1wHi5AB9fQPwWEH9X/zVZoczrjvingLsoqwGswhc8WXnHYLKPlZN7lIBEynCBlXBw8Z20h7103OwlZhv+e296eTi1hA1hbQPwDPf6X4TC1xT3g8t2LrhBul1aonsBvhjpKbBDX0d/mSi2ARYnfBsMOIYZjYPtpaeGqS29v+TsexHjHsS2rdhGmCRRhCLxTib6WS65CJV057wvhq02Nd4i0IFSE+rVSr3virv7DfJjbjvtHudsbZ570yAb4ipL8X7uE7CYPWbwrro+LNmHfQYq+bsbEA+zbMIhbg24Lu7u752C+5lRtor9H2ErN2SmjhmJP8pvzpiVX1lQjILELaZvrXjT0mEfACRuEx125DuzuZC9diAcQGtyBYhPbLBf9B/EeJmYu9mbuxycZkQVx1NWAFQNWf5T5IrP8MlQswR+lreGvU97NSfdWcFepX4dOfFc017n7/+YgF6EcdBuYZJAHJ4zUN9KWcWSOWpAasA7uG7VglEKOTrtb2K/XJ1jxuoixiAfqLLBEWOcX/8JXL5Zk/AeqMkd9nU+s3AAAAAElFTkSuQmCC"/>
					<span style="font-size: 10px; font-style:italic">DOCUMENTO ELETTRONICO FIRMATO DIGITALMENTE. COPIA CONFORME ALL'ORIGINALE.</span></p>
					</div>
					</div>					
				</body>
			</html>
			<!-- END TEMPLATE TIPO DOC DOC ATTESTATO VACCINAZIONE 11369-5-->
			</xsl:when>
			
			
			
			
			<!-- TEMPLATE TIPO DOC LETTERA DI DIMISSIONE 34105-7-->
			<xsl:when test="$codeDocument='34105-7'">
			<html>
			<head>
			<xsl:call-template name="bootstrap-css"/>
				
					<style type="text/css">/* ============= STILI PER LE TABELLE =================================*/
				@page { size: 210mm 297mm; margin: 5mm }
				body{
				 border: 5px solid black;
				 padding: 10px;
				 }
				table{
					border: none;
					width: 100%;
				}
				td{
					width: 20%;
				}
				.datatable {
					border: solid;
					border-color: #000 ;
					width: 100%;
					border-width: thin;
				}
                
				.datatable_right {
					text-align:right;
					width: 100%;
					
				}

				.tab:link {
					text-decoration : none;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #000000;
					font-weight : normal;
					text-align: left;
				}

				.tab:visited {
					text-decoration : none;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #CC3366;
					font-weight : normal;
					text-align: left;
				}	

				.tab:hover {
					text-decoration : underline;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					color: #CC0000;
					font-weight : normal;
					text-align: left;
					background-color: #FFB6C1;
				}

				.intestazionetabella {
					color : #000;
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
					background-color : #FFFFFF;
					text-align: left;
				}
		
		
				.intestazionetabellaright {
					color : #FFFFFF;
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
					background-color : #009BCC;
					text-align: right;
				}
		
				.rigapari {
					background-color : #CCE5FF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: left;
				}

				.rigadispari {
					background-color : #FFFFFF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: left;
				}

				.rigapariright {
					background-color : #CCE5FF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: right;
				}

				.rigadispariright {
					background-color : #FFFFFF;
					font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
					text-align: right;
				}

				/* STILI PER IL TESTO */
				
				
							
				h1 
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color :#000;
				text-align : left;
				font-size: 1.3em;
				font-style:italic;
				text-decoration: underline;
				}
				h2 
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color :#000;
				text-align : left;
				font-size: 1.3em;
				}
 
				h3
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-size: 1.2em;
				}
 
				h4
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-size: 1.1em;
				}
               
               	h4.titolotabella
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : left;
				font-weight : normal;
				font-size: 1.1em;
				margin-bottom:5px;
				} 

				 h4.titolotabella2
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #000;
				text-align : right;
				font-weight : normal;
				font-size: 1.1em;
				margin-bottom:5px;
				} 

				h5.sinistra
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #003366;
				text-align : left;
				font-size: 1em;
				border-width: 1px;
				border-style: solid;
				border-color: #336699;
				padding: 3px;
				margin-top: -10px;
				margin-left: 15px;
				width: auto;
				background-color: #FFF;
				position: absolute;
				/*z-index: auto;*/
				}
 
				h5.destra
				{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
				color : #003366;
				text-align : right;
				font-size: 1em;
				border-width: 1px;
				border-style: solid;
				border-color: #336699;
				padding: 3px;
				margin-top: -10px;
				margin-left: 15px;
				width: auto;
				background-color: #FFF;
				position: absolute;
				/*z-index: auto;*/
				}
 
				div#inforiepilogo{
					line-height: 1em; 
	
				}
				.riepilogosupbold {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em;
					white-space: pre; 
				}
				.riepilogosupbold_right{
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: right;
					line-height: 1em;
					white-space: pre; 
				}
				.riepilogosupboldCVP {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em;	
				}
                 .titleLetteraDimissioni {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					font-size: 1.5em;
					text-align: left;
					line-height: 1em;	
				}

				.riepilogosup {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-size: 0.9em;
					text-align: left;
					line-height: 1em; 
					white-space: pre; 
				}
				.riepilogosupCVP {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-size: 0.9em;
					text-align: justify;
					line-height: 1em; 
				}

				.titolosezione {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					color : #000;
					font-weight : bold;
					caption-side: top;	
					text-align: left;
				}

				.bold{
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : bold;
				}
 
				.normalright {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : normal;
					text-align: right;
				}

				.normalcenter {
					font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
					font-weight : normal;
					text-align: center;
				}

				.alignright {
					text-align: right;
				}

				.white {
					color : #FFFFFF;
				}
	
				#nodisplay {
					display : none;
				}

				p {
					line-height: 1.2em;
				}
				
				.titolostrutturaReferto{ margin: 0;padding:0; }
				.indirizzo_titolostrutturaReferto{ font-size: 16px; margin: 0;padding:0;}				
				.regione_titolostrutturaReferto{margin: 0;padding:0;font-size: 16px;}
				.documento_titolostrutturaReferto{margin: 10px 0 0 0;padding:0; }
				
				<!--Adeguamento Differenze xsl portale Evolutiva FSE 2.0 - 27/10/2022 -->
				.info-bottom,
				.header,
				.container-fluid,
				.col-md-8,
				.section-title,
				.header-group-content
				{ margin: 3px;padding:2; }
				
				</style>
			</head>
	      <body>
				<div>
				<table cellpadding="6"><tr><td rowspan="6"><img id="image_logo_regione" alt="" src=""><xsl:attribute name="src"><xsl:value-of select="$logo-location"/></xsl:attribute></img></td></tr>
				
				</table>
				
				<table>
				
					
					
					<tr><td>
					<h2 class="titolostrutturaReferto">
						<xsl:call-template name="regione"/>
					</h2>
					</td></tr>	
					<!--class="regione_titolostrutturaReferto"-->
					<!--- ASL-->
					<tr><td>
						<h2 class="titolostrutturaReferto">
							<xsl:call-template name="ASL_AO_EE_Decode">
								<xsl:with-param name="codice" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/>
							</xsl:call-template>
						</h2>
					</td></tr>
					
					<xsl:variable name="repartoStrutturaConcat" select="/n1:ClinicalDocument/n1:componentOf/n1:encompassingEncounter/n1:id/@assigningAuthorityName"/>
					<xsl:variable name="nomeRepartoLDO" select="substring-before($repartoStrutturaConcat,'-')"/>		
					<xsl:variable name="nomeStrutturaLDO" select="substring-after($repartoStrutturaConcat,'-')"/>
					
					
					<tr><td>
						<h2 class="titolostrutturaReferto">
							<!--<xsl:value-of select="/n1:ClinicalDocument/n1:id/@assigningAuthorityName"/>-->
							<xsl:value-of select="$nomeStrutturaLDO"/>
						</h2>
					</td></tr>	
						
						<h2 class="titolostrutturaReferto">
							<xsl:value-of select="$nomeRepartoLDO"/>	
						</h2>
						
				</table>
					<br/>
					<table>
				<tr><td>
							<span class="titleLetteraDimissioni">
													<xsl:text>Lettera di Dimissione Ospedaliera</xsl:text>
												</span></td></tr>				
				</table>
					<br/>
					<xsl:variable name="nullFlavorID" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@nullFlavor"/>
					<xsl:choose>
						<xsl:when test="$nullFlavorID = 'NA'"/>
						<xsl:otherwise>
							
							<table class="datatable2" cellpadding="3" cellspacing="0" width="90%">
								<tbody>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name)">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Assistito: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name/@nullFlavor"/>
													<xsl:choose>
														<xsl:when test="$nullFlavor='MSK'">
															<xsl:text>DATI ANAGRAFICI OSCURATI AI SENSI DELL'ART. 87 DEL DL 30 GIUGNO 2003, N.196</xsl:text>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="getName">
																<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:name"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<tr>
										<td style="width:10%">
											<span class="riepilogosupbold">
												<xsl:text>Codice Fiscale: </xsl:text>
											</span>
										</td>
										<td colspan="2">
											<span class="riepilogosup">
												<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id">
													<xsl:value-of
														select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:id/@extension" />
													<br/>
												</xsl:for-each>
											</span>
										</td><td></td>
									</tr>
									
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr)">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Indirizzo: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="nullFlavor" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:addr/@nullFlavor"/>
													<xsl:choose>
														<xsl:when test="$nullFlavor='MSK'">
															<xsl:text/>
														</xsl:when>
														<xsl:otherwise>
															<xsl:call-template name="getContactInfo">
																<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole"/>
															</xsl:call-template>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Data di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosup">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthTime/@value"/>
													</xsl:call-template>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace">
										<tr>
											<td style="width:10%">
												<span class="riepilogosupbold">
													<xsl:text>Luogo di nascita: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:call-template name="getContactInfo">
														<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:birthplace/n1:place"/>
													</xsl:call-template>
												</span>
											</td><td></td>
										</tr>
									</xsl:if>
									<xsl:if test="boolean(/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode)">
										<tr>
											<td style="width: 10%">
												<span class="riepilogosupbold">
													<xsl:text>Sesso: </xsl:text>
												</span>
											</td>
											<td colspan="2">
												<span class="riepilogosupCVP">
													<xsl:variable name="sex" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@code"/>
													<xsl:choose>
														<xsl:when test="$sex='M'">MASCHIO</xsl:when>
														<xsl:when test="$sex='F'">FEMMINA</xsl:when>
														<xsl:otherwise>
															<xsl:variable name="sex2" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:administrativeGenderCode/@displayName"/>
															<xsl:choose>
																<xsl:when test="$sex2='M'">MASCHIO</xsl:when>
																<xsl:when test="$sex2='F'">FEMMINA</xsl:when>
																<xsl:otherwise>DATO NON DISPONIBILE</xsl:otherwise>
															</xsl:choose>
														</xsl:otherwise>
													</xsl:choose>
												</span>
											</td><td></td>
										</tr>
										<!-- nuova riga paziente-->
									</xsl:if>
									<xsl:choose>
										<xsl:when test="contains('34133-9.34878-9', $codeDocument)">
											<xsl:variable name="nullFlavorUNK" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@nullFlavor"/>
											<xsl:choose>
												<xsl:when test="$nullFlavorUNK='UNK'"/>
												<xsl:otherwise>
													<tr>
														<td colspan="4">
															<span class="riepilogosupbold">
																<xsl:text>Tutore legale dell'assistito: </xsl:text>
															</span>
														</td>
													</tr>
													<tr>
														<td colspan="2">
															<span class="riepilogosupCVP">
																<xsl:call-template name="getName">
																	<xsl:with-param name="name" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:guardianPerson/n1:name"/>
																</xsl:call-template>
																<xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:addr">
																	<br/>
																	<xsl:call-template name="getContactInfo">
																		<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian"/>
																	</xsl:call-template>
																</xsl:for-each>
															</span>
														</td>
														<td style="text-align: right; width:25%">
															<span class="riepilogosupbold">
																<xsl:text>Codice identificativo: </xsl:text>
															</span>
														</td>
														<td>
															<span class="riepilogosup">
																<xsl:value-of select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole/n1:patient/n1:guardian/n1:id/@extension"/>
															</span>
														</td>
													</tr>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
									</xsl:choose>
								</tbody>
							</table>
							
						</xsl:otherwise>
					</xsl:choose>
					<br/><br/>
					
					<br/><br/>
					<h2 class="titolotabella">Struttura responsabile della conservazione della registrazione originale </h2>
					
					<table class="datatable2" cellpadding="3" cellspacing="0" width="90%">
						<tbody>
							
							
							<tr>
							
								<td style="width:10%">
									<span class="riepilogosupbold">
										<xsl:text>Struttura sanitaria</xsl:text>
										<br/>
										<xsl:text>(ASL/AO, Studio medico, ecc.): </xsl:text>
									</span>
								</td>
								
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="ASL_AO_EE_Decode">
											<xsl:with-param name="codice" select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/>
										</xsl:call-template>
									</span>
								</td>
								
								<td style="width:10%"></td>
								
								<td style="width:10%">
									<span class="riepilogosupbold">
										<xsl:text>Codice identificativo: </xsl:text>
									</span>
								</td>
								
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id/@extension"/>
									</span>
								</td>
								
								<td></td>
								
							</tr>
						
						</tbody>
					</table>
					<br/><br/>
					<xsl:if test="boolean(/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC'])">
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="2" class="intestazionetabella">Dati relativi al medico
								sostituito</th>
								</tr>
							</thead>
							<tbody>
								<xsl:call-template name="subsituteDoctor"/>
							</tbody>
						</table>
					</xsl:if>
					
					<xsl:apply-templates select="n1:component/n1:structuredBody|n1:component/n1:nonXMLBody"/>
				</div>
				
				<xsl:call-template name="bottomline"/>
				
				<!--Adeguamento Differenze xsl portale Evolutiva FSE 2.0 - 27/10/2022 -->
				<div class="info-bottom">
					<xsl:call-template name="componentOf"/>
					<xsl:call-template name="informationRecipient"/>
					<xsl:call-template name="custodian"/>
					<xsl:call-template name="documentGeneral"/>					
				</div>
				
				</body>
	    </html>
			</xsl:when>
			<!-- END TEMPLATE TIPO DOC DOC LETTERA DI DIMISSIONE 34105-7-->
			<xsl:otherwise>
			<!-- TEMPLATE LANTANAGROUP -->				
			<html>
			<head>
			<meta name="viewport" content="width=device-width, initial-scale=1"/>
			<xsl:comment> Non editare questo HTML: è stato generato via trasformazione XSLT da un documento XML CDA Release 2. </xsl:comment>
			<title class="cda-title">
			<xsl:value-of select="$title"/>
			</title>
			<xsl:call-template name="bootstrap-css"/>
			<xsl:call-template name="lantana-css"/>
			</head>
	      <body>
	        <div class="cda-render toc col-md-3" role="complementary">
	          <!-- produce table of contents -->
	          <xsl:if test="not(//n1:nonXMLBody)">
	            <xsl:if
	              test="count(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component[n1:section]) > 0">
	              <xsl:call-template name="make-tableofcontents"/>
	            </xsl:if>
	          </xsl:if>
	        </div>
	        <!-- Container: CDA Render -->
	        <div class="cda-render container-fluid col-md-9 cda-render-main" role="main" id="main">
	          <nav class="cda-render navbar-default navbar-fixed-top">
	            <div class="container-fluid">
				  	<div class="row">
		              <xsl:if test="$logo-location">
		                <div class="col-sm-1 col-xs-2">
		                  <img src="logo.png" class="img-responsive" alt="Logo" style="margin:0 auto;padding:5px;margin-top:15px;width:49px">
		                    <xsl:attribute name="src">
		                      <xsl:value-of select="$logo-location"/>
		                    </xsl:attribute>
		                  </img>
		                </div>
		              </xsl:if>
		              <div class="cda-render navbar-header patient-header">
					    <xsl:call-template name="titolo"/>
						<br/>
		                <xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
		                    <xsl:call-template name="show-name">
		                    <xsl:with-param name="name" select="n1:patient/n1:name"/>
		                  </xsl:call-template>
		                </xsl:for-each>
		              </div>
		            </div>
					<div class="row"> 
						<div style="padding:0 30px 5px 0;text-align:right;font-weight:bold;">Data di creazione del documento:
					  	<xsl:call-template name="show-time">
		                  	<xsl:with-param name="datetime" select="n1:effectiveTime"/>
		                </xsl:call-template>
						</div>
					</div>
				</div>
	          </nav>
	          <row>
	            <h1 id="top" class="cda-title">
	              <xsl:value-of select="$title"/>
	            </h1>
	          </row>
	          <!-- START display top portion of clinical document -->
	          <div class="top container-fluid">
	            <xsl:call-template name="recordTarget"/>
	            <xsl:call-template name="documentationOf"/>
	            <xsl:call-template name="author"/>
	            <xsl:call-template name="componentOf"/>
	            <xsl:call-template name="participant"/>
	            <xsl:call-template name="informant"/>
	            <xsl:call-template name="informationRecipient"/>
	            <xsl:call-template name="legalAuthenticator"/>
	          </div>
	          <!-- END display top portion of clinical document -->

	          <!-- produce human readable document content -->
	          <div class="middle" id="doc-clinical-info">
	            <xsl:apply-templates
	              select="n1:component/n1:structuredBody | n1:component/n1:nonXMLBody"/>
	          </div>
	          <!-- Footer -->
	          <div class="bottom" id="doc-info">
	            <xsl:call-template name="authenticator"/>
	            <xsl:call-template name="custodian"/>
	            <xsl:call-template name="dataEnterer"/>
	            <xsl:call-template name="documentGeneral"/>
	          </div>
	        </div>
	      </body>
	    </html>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- CORPO -->
	<xsl:template match="n1:component/n1:structuredBody">
		<xsl:choose>
			<xsl:when test="($tipoCDA = 'ITPRF_PRESC_RICO-001') or ($tipoCDA = 'ITPRF_PRESC_SPEC-001') or ($tipoCDA = 'ITPRF_PRESC_FARMA-001') or ($tipoCDA = 'ITPRF_EROG_SPEC-001') or (contains('29304-3', $codeDocument))">
				<xsl:call-template name="formatEsenzione"/>
				<xsl:choose>
					<xsl:when test="contains('29304-3', $codeDocument)">
						<xsl:apply-templates select="n1:component/n1:section" mode="erogazione"/>
					</xsl:when>
					<xsl:when test="$tipoCDA = 'ITPRF_PRESC_RICO-001'">
						<xsl:apply-templates select="n1:component/n1:section" mode="ricovero"/>
					</xsl:when>
					<xsl:when test="$tipoCDA = 'ITPRF_PRESC_SPEC-001'">
						<xsl:apply-templates select="n1:component/n1:section" mode="specialistica"/>
					</xsl:when>
					<xsl:when test="$tipoCDA = 'ITPRF_PRESC_FARMA-001'">
						<xsl:apply-templates select="n1:component/n1:section" mode="farmaceutica"/>
					</xsl:when>
					<xsl:when test="$tipoCDA = 'ITPRF_EROG_SPEC-001'">
						<xsl:apply-templates select="n1:component/n1:section" mode="erogazione"/>
					</xsl:when>
				</xsl:choose>
			</xsl:when>
			<xsl:when test="$tipoCDA = 'ITPRF_SDO_001' ">
				<xsl:apply-templates select="n1:component/n1:section" mode="sdo"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="n1:component/n1:section"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- PRESCRIZIONE SUGGERITA -->
	<xsl:template name="suggerita">
		<br/>
		<span class="riepilogosupbold">
			<xsl:text>Prescrizione suggerita: </xsl:text>
		</span>
		<span class="riepilogosup">
			<xsl:variable name="flagSuggerita" select="/n1:ClinicalDocument/n1:code/n1:translation/n1:qualifier/n1:value/@code"/>
			<xsl:choose>
				<xsl:when test="$flagSuggerita = 'S'">SI</xsl:when>
				<xsl:otherwise>
					<xsl:text>NO</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</span>
		<br/>
		<br/>
	</xsl:template>
	<!-- PRIORITA RICOVERO -->
	<xsl:template name="prioritaRicovero">
		<br/>
		<span class="riepilogosupbold">
			<xsl:text>Priorita': </xsl:text>
		</span>
		<span class="riepilogosup">
			<xsl:variable name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:act/n1:priorityCode/@code"/>
			<xsl:choose>
				<xsl:when test="$priorita = 'U'">URGENTE</xsl:when>
				<xsl:when test="$priorita = 'B'">BREVE</xsl:when>
				<xsl:when test="$priorita = 'D'">DIFFERITA</xsl:when>
				<xsl:when test="$priorita = 'P'">PROGRAMMATA</xsl:when>
				<xsl:otherwise>
					<xsl:text> </xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</span>
		<br/>
	</xsl:template>
	<!-- PRIORITA SPECIALISTICA -->
	<xsl:template name="prioritaSpecialistica">
		<br/>
		<span class="riepilogosupbold">
			<xsl:text>Priorita': </xsl:text>
		</span>
		<span class="riepilogosup">
			<xsl:variable name="priorita" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRIORITA']/n1:entry/n1:procedure/n1:priorityCode/@code"/>
			<xsl:choose>
				<xsl:when test="$priorita = 'U'">URGENTE</xsl:when>
				<xsl:when test="$priorita = 'B'">BREVE</xsl:when>
				<xsl:when test="$priorita = 'D'">DIFFERITA</xsl:when>
				<xsl:when test="$priorita = 'P'">PROGRAMMABILE</xsl:when>
				<xsl:otherwise>
					<xsl:text> </xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</span>
		<br/>
	</xsl:template>
	<!-- PRESCRIZIONE SPECIALISTICA -->
	<xsl:template match="n1:component/n1:section" mode="specialistica">
		<xsl:if test="@ID = 'PRESCRIZIONI'">
			<xsl:call-template name="prioritaSpecialistica"/>
			<xsl:call-template name="suggerita"/>
			<span class="riepilogosupbold">Prestazioni prescritte:</span>
			<table class="datatable" cellspacing="0" cellpadding="3" summary="Prestazioni prescritte">
				<thead>
					<tr>
						<th class="intestazionetabella" scope="col" style="width:20%">
							<xsl:text>Codice</xsl:text>
						</th>
						<th class="intestazionetabella" scope="col">
							<xsl:text>Descrizione</xsl:text>
						</th>
						<th class="intestazionetabellaright" scope="col">
							<xsl:text>Quantita'</xsl:text>
						</th>
					</tr>
				</thead>
				<tbody>
					<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item">
						<xsl:variable name="indice" select="position()"/>
						<tr>
							<!-- CODICE -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:code/@code"/>
							</xsl:call-template>
							<!-- DESCRIZIONE -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="n1:content"/>
							</xsl:call-template>
							<!-- QUANTITA' -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
								<xsl:with-param name="classeExtra" select="' alignright'"/>
							</xsl:call-template>
						</tr>
					</xsl:for-each>
				</tbody>
			</table>
			<xsl:apply-templates select="n1:text/n1:list"/>
		</xsl:if>
	</xsl:template>
	<!-- PRESCRIZIONE FARMACEUTICA -->
	<xsl:template match="n1:component/n1:section" mode="farmaceutica">
		<xsl:if test="@ID = 'PRESCRIZIONI'">
			<xsl:call-template name="suggerita"/>
			<span class="riepilogosupbold">Prestazioni prescritte:</span>
			<table class="datatable" cellspacing="0" cellpadding="3" summary="Prestazioni prescritte">
				<thead>
					<tr>
						<th class="intestazionetabella" scope="col" style="width:20%">
							<xsl:text>Codice</xsl:text>
						</th>
						<th class="intestazionetabella" scope="col">
							<xsl:text>Descrizione</xsl:text>
						</th>
						<th class="intestazionetabella" scope="col">
							<xsl:text>Nota AIFA</xsl:text>
						</th>
						<th class="intestazionetabella" scope="col">
							<xsl:text>Gruppo equivalenza</xsl:text>
						</th>
						<th class="intestazionetabellaright" scope="col">
							<xsl:text>Quantita'</xsl:text>
						</th>
						<th class="intestazionetabella" scope="col">
							<xsl:text>Motivo non sostituibilita'</xsl:text>
						</th>
					</tr>
				</thead>
				<tbody>
					<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item">
						<xsl:variable name="indice" select="position()"/>
						<tr>
							<!-- CODICE -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
							</xsl:call-template>
							<!-- DESCRIZIONE -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="n1:content"/>
							</xsl:call-template>
							<!-- NOTA AIFA -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
							</xsl:call-template>
							<!-- GRUPPO DI EQUIVALENZA -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@code,' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@displayName)"/>
							</xsl:call-template>
							<!-- QUANTITA' -->
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
								<xsl:with-param name="classeExtra" select="' alignright'"/>
							</xsl:call-template>
							<!-- MOTIVO NON SOSTITUIBILITA' -->
							<xsl:variable name="motivoNonSostit">
								<xsl:choose>
									<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='1'">
										<xsl:text>IPERSENSIBILITA', INTOLLERANZA, INTERAZIONE O CONTROINDICAZIONE AD ECCIPIENTI</xsl:text>
									</xsl:when>
									<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='2'">
										<xsl:text>OBIETTIVE DIFFICOLTA' DI ASSUNZIONE</xsl:text>
									</xsl:when>
									<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='3'">
										<xsl:text>TERAPIA COMPLESSA/PROBLEMATICHE ASSISTENZIALI</xsl:text>
									</xsl:when>
									<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='4'">
										<xsl:text>NON ART. 15, COMMA 11-BIS</xsl:text>
									</xsl:when>
								</xsl:choose>
							</xsl:variable>
							<xsl:call-template name="formatCell">
								<xsl:with-param name="indice" select="$indice"/>
								<xsl:with-param name="contenuto" select="$motivoNonSostit"/>
							</xsl:call-template>
						</tr>
					</xsl:for-each>
				</tbody>
			</table>
			<xsl:apply-templates select="n1:text/n1:list"/>
		</xsl:if>
	</xsl:template>
	<!-- PRESCRIZIONE RICOVERO -->
	<xsl:template match="n1:component/n1:section" mode="ricovero">
		<xsl:call-template name="prioritaRicovero"/>
		<xsl:call-template name="suggerita"/>
		<span class="riepilogosupbold">Richiesta di ricovero:</span>
		<span class="riepilogosupCVP">
			<xsl:if test="@ID = 'RICOVERO'">
				<xsl:value-of select="n1:text/n1:list[@ID = 'RQO']/n1:item/n1:content"/>
			</xsl:if>
		</span>
		<br/>
		<xsl:apply-templates select="n1:text/n1:list"/>
	</xsl:template>
	<!-- EROGAZIONE -->
	<xsl:template match="n1:component/n1:section" mode="erogazione">
		<xsl:variable name="tipoErogazione" select="@ID"/>
		<xsl:if test="($tipoErogazione = 'EROGAZIONE_SPECIALISTICA') or ($tipoErogazione = 'EROGAZIONE_FARMACEUTICA')">
			<xsl:if test="boolean(//n1:section[@ID = 'TICKET'])">
				<br/>
				<span class="riepilogosupbold">
					<xsl:text>Ticket pagato: </xsl:text>
				</span>
				<span class="riepilogosup">
					<xsl:call-template name="string-replace-all">
						<xsl:with-param name="testo" select="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction/n1:amt/@value"/>
						<xsl:with-param name="pattern" select="'.'"/>
						<xsl:with-param name="sostituisci" select="','"/>
					</xsl:call-template>
				</span>
				<br/>
			</xsl:if>
			<xsl:if test="($tipoErogazione = 'EROGAZIONE_SPECIALISTICA')">
				<xsl:if test="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction[n1:code/n1:translation/n1:qualifier/n1:value[@code='2.1']]/n1:amt/@value">
					<br/>
					<span class="riepilogosupbold">
						<xsl:text>Quota Fissa: </xsl:text>
					</span>
					<span class="riepilogosup">
						<xsl:call-template name="string-replace-all">
							<xsl:with-param name="testo" select="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction[n1:code/n1:translation/n1:qualifier/n1:value[@code='2.1']]/n1:amt/@value"/>
							<xsl:with-param name="pattern" select="'.'"/>
							<xsl:with-param name="sostituisci" select="','"/>
						</xsl:call-template>
					</span>
					<br/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="($tipoErogazione = 'EROGAZIONE_SPECIALISTICA')">
				<xsl:if test="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction[n1:code/n1:translation/n1:qualifier/n1:value[@code='2.1']]/n1:amt/@value">
					<br/>
					<span class="riepilogosupbold">
						<xsl:text>Franchigia: </xsl:text>
					</span>
					<span class="riepilogosup">
						<xsl:call-template name="string-replace-all">
							<xsl:with-param name="testo" select="//n1:section[@ID = 'TICKET']/n1:entry/n1:FinancialTransaction[n1:code/n1:translation/n1:qualifier/n1:value[@code='2.2']]/n1:amt/@value"/>
							<xsl:with-param name="pattern" select="'.'"/>
							<xsl:with-param name="sostituisci" select="','"/>
						</xsl:call-template>
					</span>
					<br/>
				</xsl:if>
			</xsl:if>
			<!-- REDDITO -->
			<xsl:if test="($tipoErogazione = 'EROGAZIONE_SPECIALISTICA')">
				<xsl:if test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='REDDITO']/n1:text/n1:content/@ID='REDDITO_ANNOTAZIONE')">
					<br/>
					<span class="riepilogosupbold">
						<xsl:text>Dichiarazione di Reddito </xsl:text>
					</span>
					<span class="riepilogosup">
						<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='REDDITO']/n1:text/n1:content"/>
					</span>
					<br/>
				</xsl:if>
			</xsl:if>
			<xsl:variable name="titoloTabella">
				<xsl:choose>
					<xsl:when test="$tipoErogazione = 'EROGAZIONE_SPECIALISTICA'">
						<xsl:value-of select="'Prestazioni erogate'"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="'Farmaci erogati'"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<br/>
			<span class="riepilogosupbold">
				<xsl:value-of select="concat($titoloTabella, ': ')"/>
			</span>
			<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[$tipoErogazione]/n1:text/n1:list[@ID = 'EROG']/n1:item">
				<xsl:variable name="indice" select="position()"/>
				<!-- SEZIONE FARMACEUTICA -->
				<xsl:if test="$tipoErogazione = 'EROGAZIONE_FARMACEUTICA'">
					<table class="datatable" cellspacing="0" cellpadding="3" summary="{$titoloTabella}">
						<thead>
							<tr scope="row" colspan="2" class="intestazionetabella">
								<!-- CODICE -->
								<td style="width:20%">
									<span class="intestazionetabella">Codice:</span>
								</td>
								<td>
									<span class="intestazionetabella">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:product/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
									</span>
								</td>

								<td style="width:20%">
									<span class="riepilogosupbold"/>
								</td>
								<td>
									<span class="riepilogosup"/>
								</td>
								<td style="width:20%">
									<span class="riepilogosupbold"/>
								</td>
								<td>
									<span class="riepilogosup"/>
								</td>
							</tr>
						</thead>
						<tbody>
							<tr>
								<!-- DESCRIZIONE -->
								<td style="width:20%">
									<span class="riepilogosupbold">Descrizione:</span>
								</td>
								<td>
									<span class="riepilogosupCVP">
										<xsl:value-of select="n1:content"/>
									</span>
								</td>
								<!-- DICH TARGA DOPPIA 
								<td style="width:20%">
									<span class="riepilogosupbold">Dich. Targa Doppia:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:act[n1:code[@code='TD']]/n1:text"/>
									</span>
								</td>-->
								<!-- ONERE PRODOTTO
								<td style="width:20%">
									<span class="riepilogosupbold">Onere Prodotto:</span>
								</td> 
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.8']]/n1:value/@value"/>
									</span>
								</td>-->
							</tr>
							<tr>
								<!-- TARGA -->
								<td style="width:20%">
									<span class="riepilogosupbold">Targa:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:product/n1:manufacturedProduct/n1:id[@root='2.16.840.1.113883.2.9.4.1.23']/@extension"/>
									</span>
								</td>
							</tr>
							<tr>
								<!-- COD. FARMACO SOST -->
								<td style="width:20%">
									<span class="riepilogosupbold">Cod. Farmaco Sostituito:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:supply/n1:product/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
									</span>
								</td>
								<!-- DATA EROGAZIONE 
								<td style="width:20%">
									<span class="riepilogosupbold">Data Erogazione:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="formatDate">
											<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:effectiveTime/@value"/>
										</xsl:call-template>
									</span>
								</td>-->
								<!-- SCONTO SSN 
								<td style="width:20%">
									<span class="riepilogosupbold">Sconto SSN:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.9']]/n1:value/@value"/>
									</span>
								</td>-->
							</tr>
							<tr>
								<!-- MOTIVO SOSTITUZIONE -->
								<td style="width:20%">
									<span class="riepilogosupbold">Motivo Sostituzione:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:variable name="motivoSostitErog">
											<xsl:choose>
												<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='0'">
													<xsl:text>NON SOSTITUIBILE A CAUSA DELLA PRESENZA IN RICETTA &#xA;DELLA MOTIVAZIONE INDICATA DAL MEDICO O &#xA;DALLA SPECIFICAZIONE DI NON APPLICABILITA' &#xA;DELL'ART. 15, COMMA 11-BIS</xsl:text>
												</xsl:when>
												<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='1'">
													<xsl:text>FARMACO CONTENENTE IL PRINCIPIO ATTIVO INDICATO &#xA;DAL MEDICO IN RICETTA</xsl:text>
												</xsl:when>
												<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='2'">
													<xsl:text>SOSTITUZIONE CON ALTRO FARMACO AVENTE PREZZO INFERIORE</xsl:text>
												</xsl:when>
												<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship[@typeCode='CAUS']/n1:act/n1:code/n1:qualifier/n1:value/@code='3'">
													<xsl:text>FARMACO A PREZZO PIU' BASSO IRREPERIBILE</xsl:text>
												</xsl:when>
											</xsl:choose>
										</xsl:variable>
										<xsl:value-of select="$motivoSostitErog"/>
									</span>
								</td>
								<!-- IMPORTO TICKET 
								<td style="width:20%">
									<span class="riepilogosupbold">Importo Ticket:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation[n1:code[@code='1.1']]/n1:value/@value"/>
									</span>
								</td>-->
								<!-- SCONTO INDUSTRIA 
								<td style="width:20%">
									<span class="riepilogosupbold">Sconto Industria:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.10']]/n1:value/@value"/>
									</span>
								</td>-->
							</tr>
							<tr>
								<!-- QUANTITA -->
								<td style="width:20%">
									<span class="riepilogosupbold">Quantita:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:quantity/@value"/>
									</span>
								</td>
								<!-- DIFF GENERICO
								<td style="width:20%">
									<span class="riepilogosupbold">Diff Generico:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.6']]/n1:value/@value"/>
									</span>
								</td> -->
								<!-- SCONTO PAYBACK 
								<td style="width:20%">
									<span class="riepilogosupbold">Sconto PayBack:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.11']]/n1:value/@value"/>
									</span>
								</td>-->
							</tr>
							<tr>
								<!-- PREZZO -->
								<td style="width:20%">
									<span class="riepilogosupbold">Prezzo:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.13']]/n1:value/@value"/>
									</span>
								</td>
								<!-- PREZZO RIMBORSO 
								<td style="width:20%">
									<span class="riepilogosupbold">Prezzo Rimborso:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.7']]/n1:value/@value"/>
									</span>
								</td>-->
								<!-- SCONTO DL31052010
								<td style="width:20%">
									<span class="riepilogosupbold">Sconto DL31052010:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_FARMACEUTICA']/n1:entry[$indice]/n1:supply/n1:entryRelationship/n1:observation/n1:entryRelationship/n1:observation[n1:code[@code='1.12']]/n1:value/@value"/>
									</span>
								</td> -->
							</tr>							
						</tbody>
					</table>
				</xsl:if>
				<!-- SEZIONE SPECIALISTICA -->
				<xsl:if test="$tipoErogazione = 'EROGAZIONE_SPECIALISTICA'">
					<table class="datatable" cellspacing="0" cellpadding="3" summary="{$titoloTabella}">
						<thead>
							<tr scope="row" colspan="2" class="intestazionetabella">
								<!-- CODICE -->
								<td style="width:20%">
									<span class="intestazionetabella">Codice:</span>
								</td>
								<td>
									<span class="intestazionetabella">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:code/@code"/>
									</span>
								</td>
								<td style="width:20%">
									<span class="riepilogosupbold"/>
								</td>
								<td>
									<span class="riepilogosup"/>
								</td>
							</tr>
						</thead>
						<tbody>
							<tr>
								<!-- DESCRIZIONE -->
								<td style="width:20%">
									<span class="riepilogosupbold">Descrizione:</span>
								</td>
								<td>
									<span class="riepilogosupCVP">
										<xsl:value-of select="n1:content"/>
									</span>
								</td>
								<!-- PREZZO RIMBORSO -->
								<td style="width:20%">
									<span class="riepilogosupbold">Prezzo Rimborso:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS']/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.4']]/n1:value/@value"/>
									</span>
								</td>
							</tr>
							<tr>
								<!-- QUANTITA -->
								<td style="width:20%">
									<span class="riepilogosupbold">Quantita:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:supply/n1:quantity/@value"/>
									</span>
								</td>
								<!-- SCONTO SSN -->
								<td style="width:20%">
									<span class="riepilogosupbold">Sconto SSN:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS']/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.5']]/n1:value/@value"/>
									</span>
								</td>
							</tr>
							<tr>
								<!-- DATA INIZIO EROGAZIONE -->
								<td style="width:20%">
									<span class="riepilogosupbold">Data Inizio Erogazione:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="formatDate">
											<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:effectiveTime/n1:low/@value"/>
										</xsl:call-template>
									</span>
								</td>
								<!-- COD. REPARTO -->
								<td style="width:20%">
									<span class="riepilogosupbold">Cod. Reparto:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id[@root='2.16.840.1.113883.2.9.4.1.6']/@extension"/>
									</span>
								</td>
							</tr>
							<tr>
								<!-- DATA FINE EROGAZIONE -->
								<td style="width:20%">
									<span class="riepilogosupbold">Data Fine Erogazione:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="formatDate">
											<xsl:with-param name="date" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:effectiveTime/n1:high/@value"/>
										</xsl:call-template>
									</span>
								</td>
								<!-- COD. PRESIDIO -->
								<td style="width:20%">
									<span class="riepilogosupbold">Cod. Presidio:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:performer/n1:assignedEntity/n1:representedOrganization[n1:id[@root='2.16.840.1.113883.2.9.4.1.6']]/n1:asOrganizationPartOf/n1:id[@root='2.16.840.1.113883.2.9.4.1.2']/@extension"/>
									</span>
								</td>
							</tr>
							<tr>
								<!-- PREZZO -->
								<td style="width:20%">
									<span class="riepilogosupbold">Prezzo:</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'EROGAZIONE_SPECIALISTICA']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:observation[@classCode='OBS'][n1:code[@code='2.3']]/n1:value/@value"/>
									</span>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:if>
			</xsl:for-each>
		</xsl:if>
	</xsl:template>
	<!-- ESENZIONE -->
	<xsl:template name="formatEsenzione">
		<xsl:variable name="esenzione">
			<xsl:choose>
				<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)">
					<xsl:choose>
						<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text != 'RICETTA NON ESENTE'">
							<xsl:choose>
								<xsl:when test="boolean(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code)">
									<xsl:value-of select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:entry/n1:act/n1:code/@code, ' - ', /n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text)"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'ESENZIONI']/n1:text"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="'RICETTA NON ESENTE'"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="'RICETTA NON ESENTE'"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<br/>
		<span class="riepilogosupbold">Esenzione (Codifica Regionale):</span>
		<span class="riepilogosupCVP">
			<xsl:value-of select="$esenzione"/>
		</span>
		<br/>
	</xsl:template>
	<!-- ANNOTAZIONI -->
	<xsl:template match="n1:text/n1:list">
		<xsl:if test="boolean(@ID = 'DIAG')">
			<xsl:variable name="annotazioni">
				<xsl:for-each select="n1:item">
					<xsl:value-of select="n1:content"/>
					<xsl:text>; </xsl:text>
				</xsl:for-each>
			</xsl:variable>
			<xsl:if test="$annotazioni != ' '">
				<br/>
				<span class="riepilogosupbold">Annotazioni:</span>
				<span class="riepilogosupCVP">
					<xsl:choose>
						<xsl:when test="not(contains($annotazioni, ';'))">
							<xsl:value-of select="$annotazioni"/>
						</xsl:when>
						<xsl:otherwise>
							<!-- call remove-duplicates template, only if <xsl:value-of select="$Vvar4_INPUT"/> 
								the string contains at-least 2 words -->
							<xsl:call-template name="remove-duplicates">
								<xsl:with-param name="string" select="$annotazioni"/>
								<xsl:with-param name="newstring" select="' '"/>
							</xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</span>
				<br/>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<!-- DATI GENERALI DELLA SDO -->
	<xsl:template match="n1:component/n1:section" mode="sdo">
		<xsl:if test="@ID = 'DIAGNOSI'">
			<!--<br/> -->
			<table class="datatable" summary="elenco diagnosi" cellpadding="3" cellspacing="0" width="90%">
				<thead>
					<tr>
						<th scope="row" colspan="3" class="intestazionetabella">Elenco diagnosi</th>
					</tr>
					<tr>
						<th class="intestazionetabella" scope="col" style="width:5%">N.</th>
						<th class="intestazionetabella" scope="col" style="width:10%">Codice</th>
						<th class="intestazionetabella" scope="col">Descrizione</th>
					</tr>
				</thead>
				<tbody>
					<xsl:call-template name="getElencoDiagnosi"/>
				</tbody>
			</table>
		</xsl:if>
		<xsl:if test="(@ID = 'RICOVERO') and (/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']/n1:entry/n1:encounter/n1:entryRelationship)">
			<table class="datatable" summary="elenco accessi" cellpadding="2" cellspacing="0" width="90%">
				<thead>
					<tr>
						<th scope="row" colspan="3" class="intestazionetabella">Elenco accessi</th>
					</tr>
					<tr>
						<th class="intestazionetabella" scope="col">Progressivo</th>
						<th class="intestazionetabella" scope="col">Data</th>
					</tr>
				</thead>
				<tbody>
					<xsl:call-template name="getElencoAccessiDH"/>
				</tbody>
			</table>
		</xsl:if>
		<xsl:if test="@ID = 'INTERVENTI'">
			<table class="datatable" width="90%" summary="Elenco interventi e procedure" cellpadding="3" cellspacing="0">
				<thead>
					<tr>
						<th class="intestazionetabella" colspan="3" scope="col">Elenco
							interventi e procedure</th>
					</tr>
					<tr>
						<th scope="col" class="intestazionetabella" style="width:5%">N.</th>
						<th scope="col" class="intestazionetabella" style="width:10%">Codice</th>
						<th scope="col" class="intestazionetabella">Descrizione</th>
					</tr>
				</thead>
				<tbody>
					<xsl:call-template name="getElencoInterventi"/>
				</tbody>
			</table>
		</xsl:if>
		<xsl:if test="@ID = 'TRASFERIMENTI'">
			<table class="datatable" width="90%" cellpadding="3" cellspacing="0" summary="Elenco trasferimenti">
				<thead>
					<tr>
						<th class="intestazionetabella" colspan="4" scope="col">Elenco
							trasferimenti</th>
					</tr>
					<tr>
						<th scope="col" class="intestazionetabella" style="width:5%">N.</th>
						<th scope="col" class="intestazionetabella" style="width:20%">Data</th>
						<th scope="col" class="intestazionetabella">U.O. di provenienza</th>
						<th scope="col" class="intestazionetabella">U.O. di arrivo</th>
					</tr>
				</thead>
				<tbody>
					<xsl:call-template name="getElencoTrasferimenti"/>
				</tbody>
			</table>
		</xsl:if>
		<xsl:if test="@ID = 'ENDOPROTESI'">
			<table class="datatable" width="90%" cellpadding="3" cellspacing="0" summary="Elenco endoprotesi">
				<thead>
					<tr>
						<th class="intestazionetabella" colspan="4" scope="col">Elenco
							endoprotesi</th>
					</tr>
					<tr>
						<th scope="col" class="intestazionetabella" style="width:5%">N.</th>
						<th scope="col" class="intestazionetabella">Descrizione</th>
					</tr>
				</thead>
				<tbody>

					<xsl:call-template name="getElencoEndoprotesi"/>
				</tbody>
			</table>
		</xsl:if>
	</xsl:template>

	<!-- Costruisce la tabella dell'elenco dei trasferimenti -->
	<xsl:template name="getElencoTrasferimenti" match="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='TRASFERIMENTI']">
		<xsl:variable name="repartoAmmissione" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']/n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension"/>
		<xsl:variable name="repartoDimissione" select="/n1:ClinicalDocument/n1:componentOf/n1:encompassingEncounter/n1:location/n1:healthCareFacility/n1:id/@extension"/>
		<xsl:variable name="reparto">Specialita' clinica:
			<xsl:value-of select="substring(./n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
			<xsl:value-of select="substring(./n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
		</xsl:variable>
		<xsl:if test="boolean(./n1:entry/n1:encounter/n1:effectiveTime)">
			<tr>
				<td>1</td>
				<td>
					<xsl:call-template name="formatDateGGMMYYYY">
						<xsl:with-param name="date" select="./n1:entry/n1:encounter/n1:effectiveTime/@value"/>
					</xsl:call-template>

				</td>
				<td>Specialita' clinica:
					<xsl:value-of select="substring($repartoAmmissione,1,2)"/>- Prog. reparto:
					<xsl:value-of select="substring($repartoAmmissione,3,2)"/>
				</td>
				<td>
					<xsl:value-of select="$reparto"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:for-each select="./n1:entry/n1:encounter/n1:entryRelationship">
			<xsl:variable name="indice" select="position()"/>
			<xsl:if test="$indice=0">
				<tr>
					<td>
						<xsl:value-of select="indice+1"/>
					</td>
					<td>
						<xsl:call-template name="formatDateGGMMYYYY">
							<xsl:with-param name="date" select="./n1:entry/n1:encounter/n1:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td>
						<xsl:value-of select="$reparto"/>
					</td>
					<td>Specialita' clinica:
						<xsl:value-of select="substring(./n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
						<xsl:value-of select="substring(./n1:entry/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="$indice=1">
				<tr>
					<td>
						<xsl:value-of select="$indice+1"/>
					</td>
					<td>
						<xsl:call-template name="formatDateGGMMYYYY">
							<xsl:with-param name="date" select="./n1:encounter/n1:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td>Specialita' clinica:
						<xsl:value-of select="substring(../n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
						<xsl:value-of select="substring(../n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
					</td>
					<td>Specialita' clinica:
						<xsl:value-of select="substring(../n1:entryRelationship[$indice]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
						<xsl:value-of select="substring(../n1:entryRelationship[$indice]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="$indice&gt;1">
				<tr>
					<td>
						<xsl:value-of select="$indice+1"/>
					</td>
					<td>
						<xsl:call-template name="formatDateGGMMYYYY">
							<xsl:with-param name="date" select="./n1:encounter/n1:effectiveTime/@value"/>
						</xsl:call-template>
					</td>
					<td>Specialita' clinica:
						<xsl:value-of select="substring(../n1:entryRelationship[($indice)-1]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
						<xsl:value-of select="substring(../n1:entryRelationship[($indice)-1]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
					</td>
					<td>Specialita' clinica:
						<xsl:value-of select="substring(../n1:entryRelationship[$indice]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,1,2)"/>- Prog. reparto:
						<xsl:value-of select="substring(../n1:entryRelationship[$indice]/n1:encounter/n1:performer/n1:assignedEntity/n1:representedOrganization/n1:id/@extension,3,2)"/>
					</td>
				</tr>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<!-- Costruisce la tabella dell'elenco dei trasferimenti -->
	<!-- Costruisce la tabella dell'elenco delle endoprotesi -->
	<xsl:template name="getElencoEndoprotesi" match="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ENDOPROTESI']">
		<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='ENDOPROTESI']/n1:entry/n1:supply/n1:product/n1:manufacturedProduct/n1:manufacturedMaterial/n1:name">
			<tr>
				<td>
					<xsl:value-of select="position()"/>
				</td>
				<td>
					<xsl:value-of select="."/>
				</td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<!-- Costruisce la tabella dell'elenco degli accessi DH -->
	<xsl:template name="getElencoAccessiDH" match="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RICOVERO']">
		<xsl:for-each select="./n1:entry/n1:encounter/n1:entryRelationship/n1:procedure/n1:effectiveTime/@value">
			<tr>
				<td style="width: 20%">
					<xsl:value-of select="position()"/>
				</td>
				<td>
					<xsl:call-template name="formatDateGGMMYYYY">
						<xsl:with-param name="date" select="."/>
					</xsl:call-template>
				</td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<!-- Costruisce la tabella dell'elenco delle diagnosi -->
	<xsl:template name="getElencoDiagnosi" match="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIAGNOSI']">
		<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='DIAGNOSI']/n1:entry/n1:observation/n1:code">
			<xsl:if test="not(./@code='8339-4')">
				<tr>
					<td>
						<xsl:value-of select="position()"/>
					</td>
					<td>
						<xsl:value-of select="./@code"/>
					</td>
					<td>
						<xsl:value-of select="./@displayName"/>
					</td>
				</tr>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<!-- Costruisce la tabella dell'elenco degli interventi -->
	<xsl:template name="getElencoInterventi" match="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='INTERVENTI']">
		<xsl:for-each select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='INTERVENTI']/n1:entry/n1:procedure/n1:code">
			<tr>
				<td>
					<xsl:value-of select="position()"/>
				</td>
				<td>
					<xsl:value-of select="./@code"/>
				</td>
				<td>
					<xsl:value-of select="./@displayName"/>
				</td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<!-- SOSTITUZIONE IN UNA STRINGA -->
	<xsl:template name="string-replace-all">
		<xsl:param name="testo"/>
		<xsl:param name="pattern"/>
		<xsl:param name="sostituisci"/>
		<xsl:choose>
			<xsl:when test="contains($testo, $pattern)">
				<xsl:value-of select="substring-before($testo, $pattern)"/>
				<xsl:value-of select="$sostituisci"/>
				<xsl:call-template name="string-replace-all">
					<xsl:with-param name="testo" select="substring-after($testo, $pattern)"/>
					<xsl:with-param name="pattern" select="$pattern"/>
					<xsl:with-param name="sostituisci" select="$sostituisci"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$testo"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- FORMATTAZIONE DI UNA CELLA DELLA TABELLA DELLE PRESTAZIONI -->
	<xsl:template name="formatCell">
		<xsl:param name="indice"/>
		<xsl:param name="contenuto"/>
		<xsl:param name="classeExtra"/>
		<td>
			<xsl:if test="$indice mod 2 = 1">
				<xsl:attribute name="class"><xsl:text>rigadispari</xsl:text><xsl:value-of select="$classeExtra"/></xsl:attribute>
			</xsl:if>
			<xsl:if test="$indice mod 2 = 0">
				<xsl:attribute name="class"><xsl:text>rigapari</xsl:text><xsl:value-of select="$classeExtra"/></xsl:attribute>
			</xsl:if>
			<xsl:call-template name="trim">
				<xsl:with-param name="s" select="$contenuto"/>
			</xsl:call-template>
		</td>
	</xsl:template>
	<!-- ELIMINAZIONE DEGLI SPAZI A SINISTRA -->
	<xsl:template name="left-trim">
		<xsl:param name="s"/>
		<xsl:choose>
			<xsl:when test="substring($s, 1, 1) = ''">
				<xsl:value-of select="$s"/>
			</xsl:when>
			<xsl:when test="normalize-space(substring($s, 1, 1)) = ''">
				<xsl:call-template name="left-trim">
					<xsl:with-param name="s" select="substring($s, 2)"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$s"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- ELIMINAZIONE DEGLI SPAZI A DESTRA -->
	<xsl:template name="right-trim">
		<xsl:param name="s"/>
		<xsl:choose>
			<xsl:when test="substring($s, 1, 1) = ''">
				<xsl:value-of select="$s"/>
			</xsl:when>
			<xsl:when test="normalize-space(substring($s, string-length($s))) = ''">
				<xsl:call-template name="right-trim">
					<xsl:with-param name="s" select="substring($s, 1, string-length($s) - 1)"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$s"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- ELIMINAZIONE DEGLI SPAZI -->
	<xsl:template name="trim">
		<xsl:param name="s"/>
		<xsl:call-template name="right-trim">
			<xsl:with-param name="s">
				<xsl:call-template name="left-trim">
					<xsl:with-param name="s" select="$s"/>
				</xsl:call-template>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<!-- -->
	<xsl:template match="n1:component/n1:section">
		<xsl:apply-templates select="n1:title">
			<xsl:with-param name="code" select="n1:code/@code"/>
		</xsl:apply-templates>
		<xsl:text> </xsl:text>
		<xsl:apply-templates select="n1:text"/>
		<xsl:if test="n1:component/n1:section">
			<div>
				<br/>
				<xsl:apply-templates select="n1:component/n1:section"/>
			</div>
		</xsl:if>
	</xsl:template>
	<xsl:template match="n1:title">
		<xsl:param name="code" select="''"/>
		<xsl:choose>
			<xsl:when test="$codeDocument='28653-4' or $codeDocument='28578-3'">
				<div class="" title="{$code}">
					<xsl:value-of select="."/>
				</div>
			</xsl:when>
			<xsl:otherwise>
				<span class="intestazionetabella" title="{$code}">
					<br/>
					<xsl:value-of select="."/>
				</span>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="n1:text">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="n1:paragraph">
		<div>
			<xsl:apply-templates/>
		</div>
	</xsl:template>
	<xsl:template match="n1:br">
		<xsl:apply-templates/>
		<br/>
	</xsl:template>
	<xsl:template match="n1:content[@ID]">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="n1:content">
		<span class="riepilogosup">
			<xsl:apply-templates/>
		</span>
	</xsl:template>
	<xsl:template match="n1:list">
		<xsl:if test="n1:caption = 'Problemi:'">
			<span class="riepilogosupbold">Annotazioni:</span>
			<span class="riepilogosup">
				<xsl:value-of select="n1:item/n1:content"/>
			</span>
		</xsl:if>
		<xsl:if test="n1:caption">
			<span class="riepilogosupbold">
				<xsl:apply-templates select="n1:caption"/>
			</span>
		</xsl:if>
		<xsl:choose>
			<xsl:when test="@listType='ordered'">
				<ol class="riepilogosup">
					<xsl:for-each select="n1:item">
						<li>
							<xsl:apply-templates/>
						</li>
					</xsl:for-each>
				</ol>
			</xsl:when>
			<xsl:otherwise>
				<ul class="riepilogosup">
					<xsl:for-each select="n1:item">
						<li>
							<xsl:apply-templates/>
						</li>
					</xsl:for-each>
				</ul>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="n1:caption">
		<xsl:apply-templates/>
		<xsl:text>: </xsl:text>
	</xsl:template>
	<xsl:template match="n1:table/@*|n1:thead/@*|n1:tfoot/@*|n1:tbody/@*|n1:colgroup/@*|n1:col/@*|n1:tr/@*|n1:th/@*|n1:td/@*">
		<xsl:copy>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="n1:table">
		<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
			<xsl:apply-templates/>
		</table>
	</xsl:template>
	<xsl:template match="n1:thead">
		<thead>
			<xsl:apply-templates/>
		</thead>
	</xsl:template>
	<xsl:template match="n1:tfoot">
		<tfoot>
			<xsl:apply-templates/>
		</tfoot>
	</xsl:template>
	<xsl:template match="n1:tbody">
		<tbody>
			<xsl:apply-templates/>
		</tbody>
	</xsl:template>
	<xsl:template match="n1:colgroup">
		<colgroup>
			<xsl:apply-templates/>
		</colgroup>
	</xsl:template>
	<xsl:template match="n1:col">
		<col>
			<xsl:apply-templates/>
		</col>
	</xsl:template>
	<xsl:template match="n1:tr">
		<tr>
			<xsl:apply-templates/>
		</tr>
	</xsl:template>
	<xsl:template match="n1:th">
		<td>
			<span class="riepilogosupboldCVP">
				<xsl:apply-templates/>
			</span>
		</td>
	</xsl:template>
	<xsl:template match="n1:td">
		<td>
			<span class="riepilogosupCVP">
				<xsl:apply-templates/>
			</span>
		</td>
	</xsl:template>
	<xsl:template match="n1:table/n1:caption">
		<caption class="riepilogosupboldCVP">
			<!--<span class="riepilogosupbold"> -->
			<xsl:apply-templates/>
			<!--</span> -->
		</caption>
	</xsl:template>
	<xsl:template match="n1:renderMultiMedia">
		<xsl:variable name="imageRef" select="@referencedObject"/>
		<xsl:choose>
			<xsl:when test="//n1:regionOfInterest[@ID=$imageRef]">
				<xsl:if test="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value[@mediaType='image/gif' or @mediaType='image/jpeg']">
					<br clear="all"/>
					<xsl:element name="img">
						<xsl:attribute name="src"><xsl:value-of select="//n1:regionOfInterest[@ID=$imageRef]//n1:observationMedia/n1:value/n1:reference/@value"/></xsl:attribute>
					</xsl:element>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="//n1:observationMedia[@ID=$imageRef]/n1:value/n1:thumbnail[@mediaType='image/gif' or  @mediaType='image/jpeg']">
					<br clear="all"/>
					<xsl:element name="img">
						<xsl:attribute name="src"><xsl:value-of select="//n1:observationMedia[@ID=$imageRef]/n1:value/n1:thumbnail"/></xsl:attribute>
					</xsl:element>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="//n1:*[@styleCode]">
		<xsl:if test="@styleCode='Bold'">
			<xsl:element name="b">
				<xsl:apply-templates/>
			</xsl:element>
		</xsl:if>
		<xsl:if test="@styleCode='Italics'">
			<xsl:element name="i">
				<xsl:apply-templates/>
			</xsl:element>
		</xsl:if>
		<xsl:if test="@styleCode='Underline'">
			<xsl:element name="u">
				<xsl:apply-templates/>
			</xsl:element>
		</xsl:if>
		<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Italics') and not (contains(@styleCode, 'Underline'))">
			<xsl:element name="b">
				<xsl:element name="i">
					<xsl:apply-templates/>
				</xsl:element>
			</xsl:element>
		</xsl:if>
		<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Italics'))">
			<xsl:element name="b">
				<xsl:element name="u">
					<xsl:apply-templates/>
				</xsl:element>
			</xsl:element>
		</xsl:if>
		<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Bold'))">
			<xsl:element name="i">
				<xsl:element name="u">
					<xsl:apply-templates/>
				</xsl:element>
			</xsl:element>
		</xsl:if>
		<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and contains(@styleCode, 'Bold')">
			<xsl:element name="b">
				<xsl:element name="i">
					<xsl:element name="u">
						<xsl:apply-templates/>
					</xsl:element>
				</xsl:element>
			</xsl:element>
		</xsl:if>
		<xsl:if test="not (contains(@styleCode,'Italics') or contains(@styleCode,'Underline') or contains(@styleCode, 'Bold'))">
			<xsl:apply-templates/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="n1:sup">
		<xsl:element name="sup">
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>
	<xsl:template match="n1:sub">
		<xsl:element name="sub">
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>
	<xsl:template name="contactTarget">
		<xsl:for-each select="/n1:ClinicalDocument/n1:participant[@typeCode='IND']">
			<xsl:variable name="telecomContact">
				<xsl:call-template name="getContactInfo">
					<xsl:with-param name="contact" select="n1:associatedEntity"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:choose>
				<xsl:when test="n1:associatedEntity[@classCode='GUAR']">
					<tr>
						<td style="width:20%">
							<span class="riepilogosupbold">
								<xsl:text>Codice Identificativo: </xsl:text>
							</span>
						</td>
						<td>
							<span class="riepilogosup">
								<xsl:value-of select="n1:associatedEntity/n1:scopingOrganization/n1:id/@extension"/>
							</span>
						</td>
					</tr>
				</xsl:when>
				<xsl:otherwise>
					<xsl:for-each select="n1:associatedEntity[@classCode='NOK']">
						<tr>
							<td colspan="2">
								<span class="riepilogosupbold">
									<xsl:call-template name="translateCode">
										<xsl:with-param name="code" select="n1:code/@code"/>
									</xsl:call-template>
								</span>
							</td>
						</tr>
						<tr>
							<td style="width:20%">
								<span class="riepilogosupbold">
									<xsl:text>Codice Identificativo: </xsl:text>
								</span>
							</td>
							<td>
								<span class="riepilogosup">
									<xsl:value-of select="n1:id/@extension"/>
								</span>
							</td>
						</tr>
						<xsl:if test="boolean(n1:associatedPerson)">
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Dati anagrafici: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosupCVP">
										<xsl:call-template name="getName">
											<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
										</xsl:call-template>
										<xsl:if test="not($telecomContact = '')">
											<br/>
											<xsl:value-of select="$telecomContact"/>
										</xsl:if>
									</span>
								</td>
							</tr>
						</xsl:if>
					</xsl:for-each>
					<xsl:for-each select="n1:associatedEntity[@classCode='ECON']">
						<tr>
							<td colspan="2">
								<span class="riepilogosupbold">
									<xsl:text>Contatto per emergenza</xsl:text>
								</span>
							</td>
						</tr>
						<tr>
							<td style="width:20%">
								<span class="riepilogosupbold">
									<xsl:text>Codice Identificativo: </xsl:text>
								</span>
							</td>
							<td>
								<span class="riepilogosup">
									<xsl:value-of select="n1:id/@extension"/>
								</span>
							</td>
						</tr>
						<xsl:if test="boolean(n1:associatedPerson)">
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Dati anagrafici: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosupCVP">
										<xsl:call-template name="getName">
											<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
										</xsl:call-template>
										<xsl:if test="not($telecomContact = '')">
											<br/>
											<xsl:value-of select="$telecomContact"/>
										</xsl:if>
									</span>
								</td>
							</tr>
						</xsl:if>
					</xsl:for-each>
					<xsl:for-each select="n1:associatedEntity[@classCode='CAREGIVER']">
						<tr>
							<td colspan="2">
								<span class="riepilogosupbold">
									<xsl:text>Contatto per assistenza</xsl:text>
								</span>
							</td>
						</tr>
						<tr>
							<td style="width:20%">
								<span class="riepilogosupbold">
									<xsl:text>Codice Identificativo: </xsl:text>
								</span>
							</td>
							<td>
								<span class="riepilogosup">
									<xsl:value-of select="n1:id/@extension"/>
								</span>
							</td>
						</tr>
						<xsl:if test="boolean(n1:associatedPerson)">
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Dati anagrafici: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosupCVP">
										<xsl:call-template name="getName">
											<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
										</xsl:call-template>
										<xsl:if test="not($telecomContact = '')">
											<br/>
											<xsl:value-of select="$telecomContact"/>
										</xsl:if>
									</span>
								</td>
							</tr>
						</xsl:if>
					</xsl:for-each>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="subsituteDoctor">
		<xsl:for-each select="/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC']">
			<xsl:variable name="telecomContact">
				<xsl:call-template name="getContactInfo">
					<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:participant[@typeCode='IND']/n1:associatedEntity[@classCode='LIC']"/>
				</xsl:call-template>
			</xsl:variable>
			<tr>
				<td style="width:20%">
					<span class="riepilogosupbold">
						<xsl:text>Codice Identificativo: </xsl:text>
					</span>
				</td>
				<td>
					<span class="riepilogosup">
						<xsl:value-of select="n1:id/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="boolean(n1:associatedPerson)">
				<tr>
					<td style="width:20%">
						<span class="riepilogosupbold">
							<xsl:text>Medico sostituito</xsl:text>
						</span>
					</td>
					<td>
						<span class="riepilogosupCVP">
							<xsl:call-template name="getName">
								<xsl:with-param name="name" select="n1:associatedPerson/n1:name"/>
							</xsl:call-template>
							<xsl:if test="not($telecomContact = '')">
								<br/>
								<xsl:value-of select="$telecomContact"/>
							</xsl:if>
						</span>
					</td>
				</tr>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="supportDoctor">
		<xsl:for-each select="/n1:ClinicalDocument/n1:informant/n1:assignedEntity">
			<tr>
				<td style="width:20%">
					<span class="riepilogosupbold">
						<xsl:text>Codice Identificativo: </xsl:text>
					</span>
				</td>
				<td>
					<span class="riepilogosup">
						<xsl:value-of select="n1:id/@extension"/>
					</span>
				</td>
			</tr>
			<xsl:if test="boolean(n1:assignedPerson)">
				<tr>
					<td style="width:20%">
						<span class="riepilogosupbold">
							<xsl:text>Medico suggeritore</xsl:text>
						</span>
					</td>
					<td>
						<span class="riepilogosupCVP">
							<xsl:call-template name="getName">
								<xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
							</xsl:call-template>
						</span>
					</td>
				</tr>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<!--PARTE INFERIORE DEL DOCUMENTO -->
	<xsl:template name="bottomline">
		<xsl:choose>
			<xsl:when test="$codeDocument='28653-4' or $codeDocument='28578-3'">
				<div>
					<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
						<thead>
							<tr>
								<th scope="row" colspan="2" class="">Dati autore del documento</th>
							</tr>
						</thead>
						<tbody>
							<xsl:for-each select="/n1:ClinicalDocument/n1:author">
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Codice Identificativo: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<!--<xsl:call-template name="getConcatID"> <xsl:with-param name="root" 
									select="n1:assignedAuthor/n1:id/@root"/> <xsl:with-param name="extension" 
									select="n1:assignedAuthor/n1:id/@extension"/> </xsl:call-template> -->
											<xsl:value-of select="n1:assignedAuthor/n1:id/@extension"/>
										</span>
									</td>
								</tr>
								<xsl:choose>
									<xsl:when test="boolean(n1:assignedAuthor/n1:assignedPerson/n1:name)">
										<tr>
											<td>
												<span class="riepilogosupboldCVP">
													<xsl:text>Dati Anagrafici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="n1:assignedAuthor/n1:assignedPerson/n1:name"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:when>
								</xsl:choose>
								<xsl:if test="boolean(/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id[@root='2.16.840.1.113883.2.9.2.160.4.2.1'] and $flagErogazione=true)">
									<tr>
										<td>
											<span class="riepilogosupbold">
												<xsl:text>Codice Regionale Farmacia: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosup">
												<xsl:value-of select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id/@extension"/>
											</span>
										</td>
									</tr>
								</xsl:if>
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Data di produzione del documento: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:time/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</xsl:for-each>
						</tbody>
					</table>
				</div>
				<div>
					<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
						<thead>
							<tr>
								<th scope="row" colspan="2" class="">Dati firmatario del documento</th>
							</tr>
						</thead>
						<tbody>
							<xsl:for-each select="/n1:ClinicalDocument/n1:legalAuthenticator">
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Codice Identificativo: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<!--<xsl:call-template name="getConcatID"> <xsl:with-param name="root" 
									select="n1:assignedEntity/n1:id/@root"/> <xsl:with-param name="extension" 
									select="n1:assignedEntity/n1:id/@extension"/> </xsl:call-template> -->
											<!--<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/> -->
											<xsl:choose>
												<xsl:when test="boolean(n1:assignedEntity/n1:id/@extension)">
													<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
								<xsl:choose>
									<xsl:when test="boolean(n1:assignedEntity/n1:assignedPerson/n1:name)">
										<tr>
											<td>
												<span class="riepilogosupboldCVP">
													<xsl:text>Dati Anagrafici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:when>
								</xsl:choose>
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Data di firma del documento: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<!-- <xsl:call-template name="formatDate"> <xsl:with-param name="date" 
									select="n1:time/@value"/> </xsl:call-template> -->
											<xsl:choose>
												<xsl:when test="boolean(n1:time/@value)">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:time/@value"/>
													</xsl:call-template>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
							</xsl:for-each>
						</tbody>
					</table>
				</div>				
			</xsl:when>
			<xsl:when test="$codeDocument='11502-2-OLD'">
				<div>
					<h4 class="titolotabella">Firmatario del documento</h4>
					<table class="datatable2" cellpadding="3" cellspacing="0" width="90%">
						<tbody>
							<xsl:for-each select="/n1:ClinicalDocument/n1:legalAuthenticator">
								<tr>
									<td style="width: 20%;">
										<span class="riepilogosupboldCVP">
											<xsl:text>Codice Fiscale: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:choose>
												<xsl:when test="boolean(n1:assignedEntity/n1:id/@extension)">
													<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
								<xsl:choose>
									<xsl:when test="boolean(n1:assignedEntity/n1:assignedPerson/n1:name)">
										<tr>
											<td style="width: 20%;">
												<span class="riepilogosupboldCVP">
													<xsl:text>Dati Anagrafici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:when>
								</xsl:choose>
								<tr>
									<td style="width: 20%;">
										<span class="riepilogosupboldCVP">
											<xsl:text>Data di firma del documento: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">											
											<xsl:choose>
												<xsl:when test="boolean(n1:time/@value)">
													<xsl:call-template name="formatDate">
														<xsl:with-param name="date" select="n1:time/@value"/>
													</xsl:call-template>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>DATO NON DISPONIBILE</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
								</tr>
							</xsl:for-each>
						</tbody>
					</table>
				</div>
				<xsl:for-each select="/n1:ClinicalDocument/n1:dataEnterer">
					<div>
						<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
							<thead>
								<tr>
									<th scope="row" colspan="2" class="">Dati incaricato della
							registrazione del documento</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Codice Identificativo: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/>
										</span>
									</td>
								</tr>
								<xsl:choose>
									<xsl:when test="boolean(n1:assignedEntity/n1:assignedPerson/n1:name)">
										<tr>
											<td>
												<span class="riepilogosupboldCVP">
													<xsl:text>Dati anagrafici: </xsl:text>
												</span>
											</td>
											<td>
												<span class="riepilogosupCVP">
													<xsl:call-template name="getName">
														<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
													</xsl:call-template>
												</span>
											</td>
										</tr>
									</xsl:when>
								</xsl:choose>
								<tr>
									<td>
										<span class="riepilogosupboldCVP">
											<xsl:text>Data di registrazione del documento: </xsl:text>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:call-template name="formatDate">
												<xsl:with-param name="date" select="n1:time/@value"/>
											</xsl:call-template>
										</span>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</xsl:for-each>
			</xsl:when>
			<xsl:otherwise>
				<br/>
				<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
					<thead>
						<tr>
							<th scope="row" colspan="2" class="intestazionetabella">Dati autore del documento</th>
						</tr>
					</thead>
					<tbody>
						<xsl:for-each select="/n1:ClinicalDocument/n1:author">
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Codice Identificativo: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="n1:assignedAuthor/n1:id/@extension"/>
									</span>
								</td>
							</tr>
							<xsl:choose>
								<xsl:when test="boolean(n1:assignedAuthor/n1:assignedPerson/n1:name)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Dati Anagrafici: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:call-template name="getName">
													<xsl:with-param name="name" select="n1:assignedAuthor/n1:assignedPerson/n1:name"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:when>
							</xsl:choose>
								<xsl:if test="n1:assignedAuthor/n1:addr or n1:assignedAuthor/n1:telecom">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Informazioni di contatto: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:call-template name="show-contactInfo">
													<xsl:with-param name="contact" select="n1:assignedAuthor"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:if>
							<xsl:if test="boolean(/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id[@root='2.16.840.1.113883.2.9.2.160.4.2.1'] and $flagErogazione=true)">
								<tr>
									<td style="width:20%">
										<span class="riepilogosupbold">
											<xsl:choose>
												<xsl:when test="$codeDocument='34109-9'">
													<xsl:text>Codice Regionale Struttura: </xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:text>Codice Regionale Farmacia: </xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</span>
									</td>
									<td>
										<span class="riepilogosup">
											<xsl:value-of select="/n1:ClinicalDocument/n1:author/n1:assignedAuthor/n1:representedOrganization/n1:id/@extension"/>
										</span>
									</td>
								</tr>
							</xsl:if>
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Data di produzione del documento: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="formatDate">
											<xsl:with-param name="date" select="n1:time/@value"/>
										</xsl:call-template>
									</span>
								</td>
							</tr>
						</xsl:for-each>
					</tbody>
				</table>
				<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
					<thead>
						<tr>
							<th scope="row" colspan="2" class="intestazionetabella">Firmato da</th>
						</tr>
					</thead>
					<tbody>
						<xsl:for-each select="/n1:ClinicalDocument/n1:legalAuthenticator">
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Codice Identificativo: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:choose>
											<xsl:when test="boolean(n1:assignedEntity/n1:id/@extension)">
												<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>DATO NON DISPONIBILE</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</span>
								</td>
							</tr>
							<xsl:choose>
								<xsl:when test="boolean(n1:assignedEntity/n1:assignedPerson/n1:name)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Dati Anagrafici: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:call-template name="getName">
													<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:when>
							</xsl:choose>
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Data di firma del documento: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:choose>
											<xsl:when test="boolean(n1:time/@value)">
												<xsl:call-template name="formatDate">
													<xsl:with-param name="date" select="n1:time/@value"/>
												</xsl:call-template>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>DATO NON DISPONIBILE</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</span>
								</td>
							</tr>
						</xsl:for-each>
					</tbody>
				</table>
				<xsl:for-each select="/n1:ClinicalDocument/n1:dataEnterer">
					<table class="datatable" cellpadding="3" cellspacing="0" width="90%">
						<thead>
							<tr>
								<th scope="row" colspan="2" class="intestazionetabella">Dati incaricato della
							registrazione del documento</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Codice Identificativo: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:value-of select="n1:assignedEntity/n1:id/@extension"/>
									</span>
								</td>
							</tr>
							<xsl:choose>
								<xsl:when test="boolean(n1:assignedEntity/n1:assignedPerson/n1:name)">
									<tr>
										<td style="width:20%">
											<span class="riepilogosupbold">
												<xsl:text>Dati anagrafici: </xsl:text>
											</span>
										</td>
										<td>
											<span class="riepilogosupCVP">
												<xsl:call-template name="getName">
													<xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
												</xsl:call-template>
											</span>
										</td>
									</tr>
								</xsl:when>
							</xsl:choose>
							<tr>
								<td style="width:20%">
									<span class="riepilogosupbold">
										<xsl:text>Data di registrazione del documento: </xsl:text>
									</span>
								</td>
								<td>
									<span class="riepilogosup">
										<xsl:call-template name="formatDate">
											<xsl:with-param name="date" select="n1:time/@value"/>
										</xsl:call-template>
									</span>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:for-each>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- TITOLO DOCUMENTO CLINICO -->
	<xsl:template name="titolo">
		<xsl:if test="$codeDocument='29305-0' or $codeDocument='57833-6'">
			<xsl:text>Prescrizione Farmaceutica</xsl:text>
		</xsl:if>
		<xsl:if test="($codeDocument='11488-4' or $codeDocument='57832-8') and ($tipoCDA = 'ITPRF_PRESC_SPEC-001')">
			<xsl:text>Prescrizione Specialistica</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='34112-3' or $codeDocument='57830-2'">
			<xsl:text>Prescrizione di Ricovero</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='29304-3'">
			<xsl:text>Erogazione Farmaceutica</xsl:text>
			<xsl:variable name="flagErogazione" select="true()"/>
		</xsl:if>
		<xsl:if test="($codeDocument='34109-9') and ($tipoCDA = 'ITPRF_EROG_SPEC-001')">
			<xsl:text>Erogazione Specialistica</xsl:text>
			<xsl:variable name="flagErogazione" select="true()"/>
		</xsl:if>
		<xsl:if test="$codeDocument='28578-3'">
			<xsl:text>Certificato INAIL</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='28653-4'">
			<xsl:text>Certificato INPS</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='18748-4'">
			<xsl:text>Referto di Radiologia</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='11502-2'">
			<xsl:text>Referto di Laboratorio</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='47045-0'">
			<xsl:text>Referto Specialistico</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='34111-5'">
			<xsl:text>Referto di Emergenza</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='22034-3'">
			<xsl:text>Referto di Anatomia Patologica</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='28568-4'">
			<xsl:text>Referto di Pronto Soccorso</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='47039-3'">
			<xsl:text>Accettazione Ospedaliera</xsl:text>
		</xsl:if>
		<!-- <xsl:if test="$codeDocument='28574-2'"> -->
		<xsl:if test="$tipoCDA = 'ITPRF_SDO_001'">
			<xsl:text>Scheda di Dimissione Ospedaliera</xsl:text>
		</xsl:if>
		<xsl:if test="($codeDocument='34105-7') and (not($tipoCDA = 'ITPRF_SDO_001'))">
			<xsl:text>Lettera di Dimissione Ospedaliera</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='28636-9'">
			<xsl:text>Prenotazione di Prestazione Specialistica</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='34878-9'">
			<xsl:text>Patient Summary - Emergency Data Set</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='11506-3'">
			<xsl:text>Annullamento Documento</xsl:text>
		</xsl:if>
		<xsl:if test="$codeDocument='34133-9' or $codeDocument='60591-5'">
			<xsl:text>Patient Summary - Profilo Sanitario Sintetico</xsl:text>
		</xsl:if>
	</xsl:template>
	<xsl:template name="getName">
		<xsl:param name="name"/>
		<xsl:choose>
			<xsl:when test="$name/n1:family">
				<xsl:if test="$name/n1:prefix">
					<xsl:value-of select="$name/n1:prefix"/>
					<xsl:text> </xsl:text>
				</xsl:if>
				<xsl:value-of select="$name/n1:family"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="$name/n1:given"/>
				<xsl:text> </xsl:text>
				<xsl:if test="$name/n1:suffix">
					<xsl:text>, </xsl:text>
					<xsl:value-of select="$name/n1:suffix"/>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$name"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="formatDate">
		<xsl:param name="date"/>
		<xsl:variable name="month" select="substring ($date, 5, 2)"/>
		<xsl:choose>
			<xsl:when test='substring ($date, 7, 1)="0"'>
				<xsl:value-of select="substring ($date, 8, 1)"/>
				<xsl:text> </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring ($date, 7, 2)"/>
				<xsl:text> </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="formatMonth">
			<xsl:with-param name="month" select="$month"/>
		</xsl:call-template>
		<xsl:text> </xsl:text>
		<xsl:value-of select="substring ($date, 1, 4)"/>
	</xsl:template>
	<xsl:template name="formatMonth">
		<xsl:param name="month"/>
		<xsl:choose>
			<xsl:when test="$month='01'">
				<xsl:text>Gennaio</xsl:text>
			</xsl:when>
			<xsl:when test="$month='02'">
				<xsl:text>Febbraio</xsl:text>
			</xsl:when>
			<xsl:when test="$month='03'">
				<xsl:text>Marzo</xsl:text>
			</xsl:when>
			<xsl:when test="$month='04'">
				<xsl:text>Aprile</xsl:text>
			</xsl:when>
			<xsl:when test="$month='05'">
				<xsl:text>Maggio</xsl:text>
			</xsl:when>
			<xsl:when test="$month='06'">
				<xsl:text>Giugno</xsl:text>
			</xsl:when>
			<xsl:when test="$month='07'">
				<xsl:text>Luglio</xsl:text>
			</xsl:when>
			<xsl:when test="$month='08'">
				<xsl:text>Agosto</xsl:text>
			</xsl:when>
			<xsl:when test="$month='09'">
				<xsl:text>Settembre</xsl:text>
			</xsl:when>
			<xsl:when test="$month='10'">
				<xsl:text>Ottobre</xsl:text>
			</xsl:when>
			<xsl:when test="$month='11'">
				<xsl:text>Novembre</xsl:text>
			</xsl:when>
			<xsl:when test="$month='12'">
				<xsl:text>Dicembre</xsl:text>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="formatDateGGMMYYYY">
		<xsl:param name="date"/>
		<xsl:variable name="month" select="substring ($date, 3, 2)"/>
		<xsl:choose>
			<xsl:when test='substring ($date, 1, 1)="0"'>
				<xsl:value-of select="substring ($date, 2, 1)"/>
				<xsl:text> </xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="substring ($date, 1, 2)"/>
				<xsl:text> </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="formatMonth">
			<xsl:with-param name="month" select="$month"/>
		</xsl:call-template>
		<xsl:text> </xsl:text>
		<xsl:value-of select="substring ($date, 5, 4)"/>
	</xsl:template>
	<xsl:template name="getConcatID">
		<xsl:param name="root"/>
		<xsl:param name="extension"/>
		<xsl:value-of select="$root"/>
		<xsl:text>.</xsl:text>
		<xsl:value-of select="$extension"/>
	</xsl:template>
	<xsl:template name="getContactInfo">
		<xsl:param name="contact"/>
		<xsl:if test="boolean($contact/n1:addr)">
			<xsl:apply-templates select="$contact/n1:addr"/>
		</xsl:if>
		<xsl:if test="boolean($contact/n1:telecom)">
			<xsl:apply-templates select="$contact/n1:telecom"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="n1:addr">
		<xsl:for-each select="n1:streetAddressLine">
			<xsl:value-of select="."/>
			<xsl:text> </xsl:text>
		</xsl:for-each>
		<xsl:if test="boolean(n1:streetName)">
			<xsl:value-of select="n1:streetName"/>
			<xsl:if test="n1:houseNumber != ''">
				<xsl:text>, </xsl:text>
				<xsl:value-of select="n1:houseNumber"/>
			</xsl:if>
			<xsl:if test="n1:postalCode != ''">
				<xsl:text> - </xsl:text>
			</xsl:if>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="n1:postalCode">
			<xsl:value-of select="n1:postalCode"/>
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="n1:city">
			<xsl:value-of select="n1:city"/>
			<xsl:if test="n1:country">
				<xsl:text>, </xsl:text>
			</xsl:if>
			<xsl:if test="n1:county">
				<xsl:text>, </xsl:text>
			</xsl:if>
		</xsl:if>
		<xsl:if test="n1:country">
			<xsl:value-of select="n1:country"/>
			<xsl:text> </xsl:text>
			<xsl:if test="n1:state">
				<xsl:text>(</xsl:text>
				<xsl:value-of select="n1:state"/>
				<xsl:text>)</xsl:text>
			</xsl:if>
		</xsl:if>
		<xsl:if test="n1:county">
			<xsl:value-of select="n1:county"/>
			<xsl:text> </xsl:text>
			<xsl:if test="n1:state">
				<xsl:text>(</xsl:text>
				<xsl:value-of select="n1:state"/>
				<xsl:text>)</xsl:text>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template match="n1:telecom">
		<xsl:variable name="type" select="@xsi:type"/>
		<xsl:variable name="value" select="@value"/>
		<br/>
		<xsl:if test="$type">
			<xsl:call-template name="translateCode">
				<xsl:with-param name="code" select="$type"/>
			</xsl:call-template>
			<xsl:text>: </xsl:text>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$value"/>
			<xsl:if test="@use">
				<xsl:text> (</xsl:text>
				<xsl:call-template name="translateCode">
					<xsl:with-param name="code" select="@use"/>
				</xsl:call-template>
				<xsl:text>)</xsl:text>
			</xsl:if>
			<br/>
		</xsl:if>
	</xsl:template>
	<xsl:template name="getConfidenzialityLevel">
		<xsl:param name="confidenziality"/>
		<xsl:variable name="code" select="$confidenziality/@code"/>
		<xsl:variable name="codeSystem" select="$confidenziality/@codeSystem"/>
		<xsl:if test="$codeSystem='2.16.840.1.113883.5.25'">
			<xsl:choose>
				<xsl:when test="$code='N'">
					<xsl:text>NORMALE</xsl:text>
				</xsl:when>
				<xsl:when test="$code='R'">
					<xsl:text>RISERVATO</xsl:text>
				</xsl:when>
				<xsl:when test="$code='V'">
					<xsl:text>MOLTO RISERVATO</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
	<xsl:template name="getConfidenzialityCode">
		<xsl:param name="confidenziality"/>
		<xsl:variable name="code" select="$confidenziality/@code"/>
		<xsl:variable name="codeSystem" select="$confidenziality/@codeSystem"/>
		<xsl:if test="$codeSystem='2.16.840.1.113883.5.25'">
			<xsl:choose>
				<xsl:when test="$code='N'">
					<xsl:text>NORMALE</xsl:text>
				</xsl:when>
				<xsl:when test="$code='R'">
					<xsl:text>RISERVATO</xsl:text>
				</xsl:when>
				<xsl:when test="$code='V'">
					<xsl:text>MAGGIOR TUTELA</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
	<xsl:template name="relatedDocumentType">
		<xsl:param name="parentDocumentID"/>
		<xsl:variable name="rootID" select="$parentDocumentID/n1:id/@root"/>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.4.3.6'">
			<xsl:text>Prescrizione</xsl:text>
		</xsl:if>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.4.3.4'">
			<xsl:text>Erogazione</xsl:text>
		</xsl:if>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.4.3.5'">
			<xsl:text>Erogazione</xsl:text>
		</xsl:if>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.2.160.4.9'">
			<xsl:text>Prenotazione</xsl:text>
		</xsl:if>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.2.160.4.6'">
			<xsl:text>Accettazione/SDO</xsl:text>
		</xsl:if>
		<xsl:if test="$rootID='2.16.840.1.113883.2.9.2.160.4.4'">
			<xsl:if test="$codeDocument='11506-3'">
				<xsl:text>Ceritificato INPS/INAIL</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='18748-4'">
				<xsl:text>Referto Radiologia</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='11502-2'">
				<xsl:text>Referto Laboratorio</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='22034-3'">
				<xsl:text>Referto Anatomia Patologica</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='28568-4'">
				<xsl:text>Referto Pronto Soccorso</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='34105-7'">
				<xsl:text>Lettera Dimissione Ospedaliera</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='34878-9'">
				<xsl:text>Patient Summary - Emergency Data Set</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='34133-9' or $codeDocument='60591-5'">
				<xsl:text>Patient Summary - Profilo Sanitario Sintetico</xsl:text>
			</xsl:if>
		</xsl:if>
		<xsl:if test="contains($rootID,'2.16.840.1.113883.2.9.2')">
			<xsl:if test="$codeDocument='34105-7'">
				<xsl:text>Lettera Dimissione Ospedaliera</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='34111-5'">
				<xsl:text>Referto Emergenza</xsl:text>
			</xsl:if>
			<xsl:if test="$codeDocument='47045-0'">
				<xsl:text>Referto Specialistico</xsl:text>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template name="translateCode">
		<xsl:param name="code"/>
		<xsl:choose>
			<xsl:when test="$code='TEL'">
				<xsl:text>Tel</xsl:text>
			</xsl:when>
			<xsl:when test="$code='FAX'">
				<xsl:text>Fax</xsl:text>
			</xsl:when>
			<xsl:when test="$code='HP'">
				<xsl:text>Abitazione</xsl:text>
			</xsl:when>
			<xsl:when test="$code='WP'">
				<xsl:text>Ufficio</xsl:text>
			</xsl:when>
			<xsl:when test="$code='RPLC'">
				<xsl:text>Documento sostituito: </xsl:text>
			</xsl:when>
			<xsl:when test="$code='APND'">
				<xsl:text>Documento a cui</xsl:text>
				<br/>
				<xsl:text>restringere accesso: </xsl:text>
			</xsl:when>
			<xsl:when test="$code='XFRM'">
				<xsl:text>Documento annullato: </xsl:text>
			</xsl:when>
			<xsl:when test="$code='B'">
				<xsl:text>Piccole Biopsie</xsl:text>
			</xsl:when>
			<xsl:when test="$code='S'">
				<xsl:text>Surgical (Grandi Pezzi)</xsl:text>
			</xsl:when>
			<xsl:when test="$code='P'">
				<xsl:text>Pap Test</xsl:text>
			</xsl:when>
			<xsl:when test="$code='C'">
				<xsl:text>Citologico</xsl:text>
			</xsl:when>
			<xsl:when test="$code='9947008'">
				<xsl:text>Padre naturale</xsl:text>
			</xsl:when>
			<xsl:when test="$code='65656005'">
				<xsl:text>Madre naturale</xsl:text>
			</xsl:when>
			<xsl:when test="$code='60614009'">
				<xsl:text>Fratello naturale</xsl:text>
			</xsl:when>
			<xsl:when test="$code='73678001'">
				<xsl:text>Sorella naturale</xsl:text>
			</xsl:when>
			<xsl:when test="$code='160461001'">
				<xsl:text>Nonno paterno</xsl:text>
			</xsl:when>
			<xsl:when test="$code='160463003'">
				<xsl:text>Nonna paterna</xsl:text>
			</xsl:when>
			<xsl:when test="$code='160460000'">
				<xsl:text>Nonno materno</xsl:text>
			</xsl:when>
			<xsl:when test="$code='160462008'">
				<xsl:text>Nonna materna</xsl:text>
			</xsl:when>
			<xsl:when test="$code='160465005'">
				<xsl:text>Zio</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>{$code}?</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="remove-duplicates">
		<xsl:param name="string"/>
		<xsl:param name="newstring"/>
		<xsl:choose>
			<xsl:when test="$string = ''">
				<xsl:value-of select="$newstring"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="contains($newstring,substring-before($string, ';'))">
					<xsl:call-template name="remove-duplicates">
						<xsl:with-param name="string" select="substring-after($string, ';')"/>
						<xsl:with-param name="newstring" select="$newstring"/>
					</xsl:call-template>
				</xsl:if>
				<xsl:if test="not(contains($newstring,substring-before($string, ';')))">
					<xsl:variable name="temp">
						<xsl:if test="$newstring = ''">
							<xsl:value-of select="substring-before($string, ';')"/>
						</xsl:if>
						<xsl:if test="not($newstring = '')">
							<xsl:value-of select="concat($newstring,substring-before($string, ';'), '; ')"/>
						</xsl:if>
					</xsl:variable>
					<xsl:call-template name="remove-duplicates">
						<xsl:with-param name="string" select="substring-after($string, ';')"/>
						<xsl:with-param name="newstring" select="$temp"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="formatTimestamp">
		<xsl:param name="date"/>
		<xsl:variable name="yyyy" select="substring ($date, 1, 4)"/>
		<xsl:variable name="mm" select="substring ($date, 5, 2)"/>
		<xsl:variable name="dd" select="substring ($date, 7, 2)"/>
		<xsl:value-of select="$dd"/>/<xsl:value-of select="$mm"/>/<xsl:value-of select="$yyyy"/>
	</xsl:template>
	<xsl:template name="formatTimestampSHORT">
		<xsl:param name="date"/>
		<xsl:variable name="yy" select="substring ($date, 3, 2)"/>
		<xsl:variable name="mm" select="substring ($date, 5, 2)"/>
		<xsl:variable name="dd" select="substring ($date, 7, 2)"/>
		<xsl:value-of select="$dd"/>
		<xsl:value-of select="$mm"/>
		<xsl:value-of select="$yy"/>
	</xsl:template>
	<xsl:template name="formatTimestampLong">
		<xsl:param name="date"/>
		<xsl:variable name="yy" select="substring ($date, 1, 4)"/>
		<xsl:variable name="mm" select="substring ($date, 5, 2)"/>
		<xsl:variable name="dd" select="substring ($date, 7, 2)"/>
		<xsl:variable name="hh" select="substring ($date, 9, 2)"/>
		<xsl:variable name="MM" select="substring ($date, 11, 2)"/>
		<xsl:if test="string-length(concat($dd,$mm,$yy))>5">
			<xsl:value-of select="$dd"/>/<xsl:value-of select="$mm"/>/<xsl:value-of select="$yy"/>
		</xsl:if>
		<xsl:text> </xsl:text>
		<xsl:if test="string-length(concat($hh,$MM))>3">
			<xsl:value-of select="$hh"/>:<xsl:value-of select="$MM"/>
		</xsl:if>
	</xsl:template>
	<xsl:template name="titolostruttura">
		<xsl:choose>
			<xsl:when test="($tipoCDA = 'ITPRF_SDO_001') or ($tipoCDA = 'ITPRF_[REFERTO SPEC]-001') or ($tipoCDA = 'ITPRF_[REFERTO PS]-001') or ($tipoCDA = 'ITPRF_LETTDIM-001') ">
				<!--CDA DELLA SDO O CDA REF. SPECIALISTICO OR PS OR RICOVERO -->
				<xsl:value-of select="/n1:ClinicalDocument/n1:id/@assigningAuthorityName"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
				<br/>
				<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr)">
					<xsl:call-template name="getContactInfo">
						<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="regione">
		<xsl:choose>
			<xsl:when test="contains($codeRegione,'160')">
				<xsl:text>Regione Puglia</xsl:text>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ASL_AO_EE_Decode">
		<xsl:param name="codice"/>
		<xsl:choose>
			<xsl:when test="contains($codice,'160106')">
				<xsl:text>ASL BRINDISI</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160112')">
				<xsl:text>ASL TARANTO</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160113')">
				<xsl:text>ASL BAT</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160114')">
				<xsl:text>ASL BARI</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160115')">
				<xsl:text>ASL FOGGIA</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160116')">
				<xsl:text>ASL LECCE</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160907')">
				<xsl:text>AO POLICLINICO DI BARI</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160910')">
				<xsl:text>AO OSPEDALI RIUNITI DI FOGGIA</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160901')">
				<xsl:text>IRCCS ONCOLOGICO - BARI</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160902')">
				<xsl:text>IRCCS DE BELLIS - CASTELLANA GROTTE</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160906')">
				<xsl:text>IRCCS S. MAUGERI - CASSANO DELLE MURGE</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160078')">
				<xsl:text>EE MIULLI - ACQUAVIVA DELLE FONTI</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160905')">
				<xsl:text>EE CASA SOLLIEVO - SAN GIOVANNI ROTONDO</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160080')">
				<xsl:text>EE CARDINALE PANICO - TRICASE</xsl:text>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ASL_Decode">
		<xsl:param name="codice"/>
		<xsl:choose>
			<xsl:when test="contains($codice,'160106')">
				<xsl:text>BR</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160112')">
				<xsl:text>TA</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160113')">
				<xsl:text>BT</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160114')">
				<xsl:text>BA</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160115')">
				<xsl:text>FG</xsl:text>
			</xsl:when>
			<xsl:when test="contains($codice,'160116')">
				<xsl:text>LE</xsl:text>
			</xsl:when>			
		</xsl:choose>
	</xsl:template>
	<xsl:template name="titolostrutturaReferto">
		<h2 class="titolostrutturaReferto">
			<xsl:value-of select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"/>
		</h2>
		<xsl:if test="boolean(/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr)">
			<h3 class="indirizzo_titolostrutturaReferto">
				<xsl:call-template name="getContactInfo">
					<xsl:with-param name="contact" select="/n1:ClinicalDocument/n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
				</xsl:call-template>
			</h3>
		</xsl:if>
	</xsl:template>
	<xsl:template name="PRESCR-TIPO-RICETTA">
		<xsl:choose>
			<xsl:when test="$qualifierTipoAss='IT'">
				<xsl:text>Assist.SSN</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$qualifierTipoAss"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="prioritaRicettaRossa">
		<xsl:param name="priorita"/>
		<xsl:choose>
			<xsl:when test="$priorita = 'U'">
				<div id="urgente">X</div>
			</xsl:when>
			<xsl:when test="$priorita = 'B'">
				<div id="breve">X</div>
			</xsl:when>
			<xsl:when test="$priorita = 'D'">
				<div id="differita">X</div>
			</xsl:when>
			<xsl:when test="$priorita = 'P'">
				<div id="programmata">X</div>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text> </xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ciclaPrescrizioniRossaFarma">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item[$indice]"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
		<xsl:variable name="item_annotation" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='COMP']/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.5.1.4']/../n1:text"/>
		<xsl:variable name="item_codice" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
		<xsl:variable name="item_gruppo_equiv_code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@code"/>
		<xsl:variable name="item_gruppo_equiv_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@displayName"/>
		<xsl:variable name="item_nota_aifa" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt;= $count">
			<!-- CODICE -->
			<xsl:if test="string-length($item_codice)>0">
				<xsl:value-of select="concat($item_codice,':')"/>
			</xsl:if>
			<!-- DESCRIZIONE -->
			<xsl:value-of select="$item_name"/>
			<xsl:if test="string-length($item_gruppo_equiv_name)>0">
				<xsl:value-of select="concat('-gruppo di equivalenza:',$item_gruppo_equiv_name)"/>
			</xsl:if>
			<xsl:if test="string-length($item_quantity)>0">
				<xsl:value-of select="concat('-n:',$item_quantity)"/>
			</xsl:if>
			<!-- MOTIVO NON SOSTITUIBILITA' -->
			<xsl:variable name="motivoNonSostit">
				<xsl:choose>
					<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='1'">
						<xsl:text>NON SOSTITUIBILE - IPERSENSIBILITA', INTOLLERANZA, INTERAZIONE O CONTROINDICAZIONE AD ECCIPIENTI</xsl:text>
					</xsl:when>
					<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='2'">
						<xsl:text>NON SOSTITUIBILE - OBIETTIVE DIFFICOLTA' DI ASSUNZIONE</xsl:text>
					</xsl:when>
					<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='3'">
						<xsl:text>NON SOSTITUIBILE  - TERAPIA COMPLESSA/PROBLEMATICHE ASSISTENZIALI</xsl:text>
					</xsl:when>
					<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='4'">
						<xsl:text>NON SOSTITUIBILE  - NON ART. 15, COMMA 11-BIS</xsl:text>
					</xsl:when>
				</xsl:choose>
			</xsl:variable>
			<xsl:if test="string-length($motivoNonSostit)>0">
				<xsl:value-of select="concat('-motivo:',$motivoNonSostit)"/>
			</xsl:if>
			<xsl:if test="string-length($item_annotation)>0">			
				<xsl:value-of select="concat('-nota:',$item_annotation)"/>
			</xsl:if>
			<br/>		
			<xsl:call-template name="ciclaPrescrizioniRossaFarma">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="ciclaPrescrizioni">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item[$indice]"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
		<xsl:variable name="item_annotation" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='COMP']/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.5.1.4']/../n1:text"/>
		<xsl:variable name="item_codice" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@code"/>
		<xsl:variable name="item_gruppo_equiv_code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@code"/>
		<xsl:variable name="item_gruppo_equiv_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@displayName"/>
		<xsl:variable name="item_nota_aifa" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt; 4">
			<tr class="table_prescrizioni_dati">
				<td class="table_prescrizioni_field_first table_prescrizioni_field1">
					<div class="testo_prescrizione">						
						<!-- GRUPPO DI EQUIVALENZA -->
						<xsl:if test="string-length($item_gruppo_equiv_code)>0">
							<xsl:value-of select="concat($item_gruppo_equiv_code,' ',$item_gruppo_equiv_name)"/>
						</xsl:if>
						<!-- CODICE -->
						<xsl:if test="string-length($item_codice)>0">
							<xsl:value-of select="concat(' - ',$item_codice,' - ')"/>
						</xsl:if>
						<!-- DESCRIZIONE -->
						<xsl:value-of select="$item_name"/>
						<!-- MOTIVO NON SOSTITUIBILITA' -->
						<xsl:variable name="motivoNonSostit">
							<xsl:choose>
								<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='1'">
									<xsl:text>NON SOSTITUIBILE - IPERSENSIBILITA', INTOLLERANZA, INTERAZIONE O CONTROINDICAZIONE AD ECCIPIENTI</xsl:text>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='2'">
									<xsl:text>NON SOSTITUIBILE - OBIETTIVE DIFFICOLTA' DI ASSUNZIONE</xsl:text>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='3'">
									<xsl:text>NON SOSTITUIBILE  - TERAPIA COMPLESSA/PROBLEMATICHE ASSISTENZIALI</xsl:text>
								</xsl:when>
								<xsl:when test="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='SUBJ']/n1:observation/n1:entryRelationship/n1:observation/n1:code/@code='4'">
									<xsl:text>NON SOSTITUIBILE  - NON ART. 15, COMMA 11-BIS</xsl:text>
								</xsl:when>
							</xsl:choose>
						</xsl:variable>
						<xsl:if test="string-length($motivoNonSostit)>0">
							<xsl:value-of select="concat(' - ',$motivoNonSostit)"/>
						</xsl:if>
						<xsl:if test="string-length($item_annotation)>0">
							<xsl:value-of select="concat(' - ',$item_annotation)"/>
						</xsl:if>
					</div>
				</td>
				<td class="table_prescrizioni_field table_prescrizioni_field2">
					<div class="testo_prescrizione">
						<div style="margin-top:7px;"><xsl:value-of select="$item_quantity"/></div>
					</div>
				</td>
				<td class="table_prescrizioni_field table_prescrizioni_field3">
					<div class="testo_prescrizione">
						<!-- NOTA AIFA -->
						<div style="margin-top:7px;">
							<xsl:choose xml:space="default">
								<xsl:when test="string-length($item_nota_aifa)>0">
									<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="$item_codice">
										<xsl:text>---</xsl:text>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</div>
					</div>
				</td>
			</tr>
			<xsl:call-template name="ciclaPrescrizioni">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="contaPrescrizioni">
		<xsl:param name="numItems" select="0"/>
		<xsl:param name="indice" select="0"/>
		<xsl:param name="count" select="0"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
		<xsl:choose>
			<xsl:when test="$indice &lt; number($numItems+1)">
				<xsl:call-template name="contaPrescrizioni">
					<xsl:with-param name="numItems" select="$numItems"/>
					<xsl:with-param name="indice" select="$indice + 1"/>
					<xsl:with-param name="count" select="$count + $item_quantity"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$count"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ciclaPrescrizioniSPEC">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:text/n1:list[@ID = 'RQO']/n1:item[$indice]"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:supply/n1:quantity/@value"/>
		<xsl:variable name="item_codice" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:code/@code"/>
		<xsl:variable name="item_codcatreg" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:code/n1:qualifier/n1:value/@code"/>
		<xsl:variable name="item_tipoAccesso" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode='SAS']/n1:encounter/@moodCode"/>
		<!-- ANNOTAZIONE 48767-8 &codeSystem='2.16.840.1.113883.6.1' -->
		<xsl:variable name="item_actCodeDescrTestoLiberoNote" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:entryRelationship/n1:act/n1:code[@code='48767-8']/../n1:text"/>
		<!-- TODO: da revisionare -->
		<xsl:variable name="item_annotation" select="/n1:ClinicalDocument/n1:component[1]/n1:structuredBody[1]/n1:component[1]/n1:section[1]/n1:entry[$indice]/n1:substanceAdministration[1]/n1:entryRelationship[2]/n1:act[1]/n1:code[@codeSystem]/ancestor::n1:act/n1:text"/>
		<xsl:variable name="item_gruppo_equiv_code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@code"/>
		<xsl:variable name="item_gruppo_equiv_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/n1:translation[@codeSystem='2.16.840.1.113883.2.9.6.1.51']/@displayName"/>
		<xsl:variable name="item_nota_aifa" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
		<!-- Evolutiva nuovi LEA 22/02/2024 -->
		<xsl:variable name="item_numSedute" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:observation/n1:repeatNumber/@value"/>
		<!-- END TODO: da revisionare -->
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt; 10">
			<tr class="table_prescrizioni_dati">
				<td class="table_prescrizioni_field_first table_prescrizioni_field1">
					<div class="testo_prescrizione">
						<!-- CODICE -->
						<xsl:if test="string-length($item_codice)>0">
							<xsl:value-of select="$item_codice"/>
							<xsl:if test="string-length($item_codcatreg)>0">
								<xsl:value-of select="concat(' (',$item_codcatreg,')')"/>
							</xsl:if>
							<xsl:text> - </xsl:text>
						</xsl:if>						
						<!-- DESCRIZIONE -->
						<xsl:value-of select="$item_name"/>
						<!-- GRUPPO DI EQUIVALENZA -->
						<xsl:if test="string-length($item_gruppo_equiv_code)>0">
							<xsl:value-of select="concat($item_gruppo_equiv_code,' ',$item_gruppo_equiv_name)"/>
						</xsl:if>
						<br/>
						
						<!-- Decrizione Tipologia Accesso -->
						<xsl:choose xml:space="default">
							<xsl:when test="$item_tipoAccesso='APT'">
								<xsl:text>PRIMO ACCESSO</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:if test="$item_tipoAccesso='EVN'">
									<xsl:text>ALTRA TIPOLOGIA DI ACCESSO</xsl:text>
								</xsl:if>
							</xsl:otherwise>
						</xsl:choose>
						
						<!-- Decrizione Note medico -->
						<xsl:if test="string-length($item_actCodeDescrTestoLiberoNote)>0">
						<!-- Evolutiva nuovi LEA 22/02/2024 -->
						<!-- viene visto se mettere il - perchè è stato scritto precedentemente un valore -->
							<xsl:if test="$item_tipoAccesso='APT' or $item_tipoAccesso='EVN'"> 
								<xsl:text> - </xsl:text>
							</xsl:if>
							<xsl:value-of select="$item_actCodeDescrTestoLiberoNote"/>
						</xsl:if>
						
						<!-- Evolutiva nuovi LEA 22/02/2024 -->
						<!-- Decrizione Numero Sedute -->
						<xsl:if test="string-length($item_numSedute)>0">
						<!-- viene visto se mettere il - perchè è stato scritto precedentemente un valore -->
							<xsl:if test="$item_tipoAccesso='APT' or $item_tipoAccesso='EVN' or string-length($item_actCodeDescrTestoLiberoNote)>0"> 
								<xsl:text> - </xsl:text>
							</xsl:if>
							<xsl:text>N.SEDUTE: </xsl:text>
							<xsl:value-of select="$item_numSedute"/>
						</xsl:if>
						
					</div>
				</td>
				<td class="table_prescrizioni_field table_prescrizioni_field2">
					<div class="testo_prescrizione">
						<xsl:value-of select="$item_quantity"/>
					</div>
				</td>
				<td class="table_prescrizioni_field table_prescrizioni_field3">
					<div class="testo_prescrizione">
						<!-- NOTA AIFA -->
						<xsl:choose xml:space="default">
							<xsl:when test="string-length($item_nota_aifa)>0">
								<xsl:value-of select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID = 'PRESCRIZIONI']/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship[@typeCode='REFR']/n1:act/n1:code/@code"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:if test="$item_codice">
									<xsl:text>---</xsl:text>
								</xsl:if>
							</xsl:otherwise>
						</xsl:choose>
					</div>
				</td>
			</tr>
			<xsl:call-template name="ciclaPrescrizioniSPEC">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="contaPrescrizioniSPEC">
		<xsl:param name="numItems" select="0"/>
		<xsl:param name="indice" select="0"/>
		<xsl:param name="count" select="0"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry[$indice]/n1:observation/n1:entryRelationship[@typeCode = 'COMP']/n1:supply/n1:quantity/@value"/>
		<xsl:choose>
			<xsl:when test="$indice &lt; number($numItems+1)">
				<xsl:call-template name="contaPrescrizioniSPEC">
					<xsl:with-param name="numItems" select="$numItems"/>
					<xsl:with-param name="indice" select="$indice + 1"/>
					<xsl:with-param name="count" select="$count + $item_quantity"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$count"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	
	<xsl:template name="motivoAccesso">
		<xsl:variable name="code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.61']/@code"/>
		<xsl:choose>			
			<xsl:when test="$code='1'">COMA</xsl:when>
			<xsl:when test="$code='2'">ACUTA</xsl:when>
			<xsl:when test="$code='3'">NERVOSO</xsl:when>
			<xsl:when test="$code='4'">ADDOMINALE</xsl:when>
			<xsl:when test="$code='5'">TORACICO</xsl:when>
			<xsl:when test="$code='6'">DISPNEA</xsl:when>
			<xsl:when test="$code='7'">PRECORDIALE</xsl:when>
			<xsl:when test="$code='8'">SHOCK</xsl:when>
			<xsl:when test="$code='10'">TRAUMA</xsl:when>
			<xsl:when test="$code='9'">TRAUMATICA</xsl:when>
			<xsl:when test="$code='11'">INTOSSICAZIONE</xsl:when>
			<xsl:when test="$code='12'">FEBBRE</xsl:when>
			<xsl:when test="$code='13'">ALLERGICA</xsl:when>
			<xsl:when test="$code='14'">RITMO</xsl:when>
			<xsl:when test="$code='15'">ARTERIOSA</xsl:when>
			<xsl:when test="$code='16'">PSICOMOTORIA</xsl:when>
			<xsl:when test="$code='17'">OCULISTICI</xsl:when>
			<xsl:when test="$code='18'">OTORINOLARINGOIATRICI</xsl:when>
			<xsl:when test="$code='19'">GINECOLOGICI</xsl:when>
			<xsl:when test="$code='20'">DERMATOLOGICI</xsl:when>
			<xsl:when test="$code='21'">ODONTOSTOMATOLOGICI</xsl:when>
			<xsl:when test="$code='22'">UROLOGICI</xsl:when>
			<xsl:when test="$code='23'">DISTURBI</xsl:when>
			<xsl:when test="$code='24'">LEGALI</xsl:when>
			<xsl:when test="$code='25'">SOCIALE</xsl:when>
			<xsl:when test="$code='26'">SOGGETTO</xsl:when>
			<xsl:when test="$code='27'">USTIONE</xsl:when>
			<xsl:when test="$code='28'">PSICHIATRICO</xsl:when>
			<xsl:when test="$code='29'">PNEUMOLOGIA/PATOLOGIA RESPIRATORIA</xsl:when>
			<xsl:when test="$code='30'">ALTRUI</xsl:when>
			<xsl:when test="$code='31'">AUTOLESIONISMO</xsl:when>
			<xsl:when test="$code='98'">DISIDRATAZIONE</xsl:when>
			<xsl:when test="$code='99'">ANIMALE</xsl:when>
			<xsl:otherwise>ALTRO</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="motivoAccessoQualifier">
		<xsl:variable name="code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:entry/n1:encounter/n1:entryRelationship/n1:act/n1:code[@codeSystem='2.16.840.1.113883.2.9.6.1.61']/n1:qualifier/n1:value/@code"/>
		<xsl:choose>
			<xsl:when test="$code='0'">INCIDENTE STRADALE IN ITINERE</xsl:when>
			<xsl:when test="$code='1'">AGGRESSIONE</xsl:when>
			<xsl:when test="$code='2'">AUTOLESIONISMO</xsl:when>
			<xsl:when test="$code='3'">INCIDENTE SUL LAVORO</xsl:when>
			<xsl:when test="$code='4'">INCIDENTE DOMESTICO</xsl:when>
			<xsl:when test="$code='5'">INCIDENTE SCOLASTICO NON INAIL</xsl:when>
			<xsl:when test="$code='6'">INCIDENTE SPORTIVO</xsl:when>
			<xsl:when test="$code='7'">INCIDENTE IN STRADA</xsl:when>
			<xsl:when test="$code='8'">INCIDENTE IN ITINERE</xsl:when>
			<xsl:when test="$code='9'">INCIDENTE IN ALTRI LUOGHI</xsl:when>
			<xsl:when test="$code='10'">INCIDENTE SCOLASTICO INAIL</xsl:when>
			<xsl:otherwise></xsl:otherwise>
		</xsl:choose>
	</xsl:template>
		<xsl:template name="modoArrivo">		
		<xsl:variable name="displayName" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section/n1:code[@code='11459-5']/../n1:entry/n1:act/n1:code/n1:translation/@displayName"/>
		<xsl:value-of select="$displayName"/>		
	</xsl:template>
	<xsl:template name="rpsCiclaFarmaciSomministrati">
		<xsl:param name="count" select="0"/>
		<xsl:param name="type"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:consumable/n1:manufacturedProduct/n1:manufacturedLabeledDrug/n1:code/@displayName"/>
		<xsl:variable name="item_type" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:entryRelationship/n1:act/n1:code/n1:translation/@displayName"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:doseQuantity/@value"/>
		<xsl:variable name="item_dose" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:text/text()"/>
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:effectiveTime/@value"/>		
		<xsl:variable name="item_operator" select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family/text(),' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:substanceAdministration/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given/text())"/>
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt;= $count">
			<tr class="">
				<td class="">
					<xsl:value-of select="$indice"/>
				</td>
				<td>
					<xsl:value-of select="$item_type"/>
				</td>
				<td>
					<xsl:value-of select="$item_name"/>
				</td>
				<td>
					<xsl:value-of select="$item_dose"/>
				</td>				
				<td>
					<xsl:value-of select="$item_quantity"/>
				</td>
				<td>
					<xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template>
				</td>				
				<td style="display:block;max-width:160px;word-break:break-all;">
					<xsl:value-of select="$item_operator"/>
				</td>					
			</tr>
			<xsl:call-template name="rpsCiclaFarmaciSomministrati">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="type" select="$type"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="rpsCiclaRifiuti">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='RIFIUTI']/n1:entry[$indice]/n1:act/n1:text"/>		
		<xsl:variable name="code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='RIFIUTI']/n1:entry[$indice]/n1:act/n1:code/@code"/>		
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section[@ID='RIFIUTI']/n1:entry[$indice]/n1:act/n1:effectiveTime/@value"/>		
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt;= $count">
			<tr class="">
				<td class="">
					<xsl:value-of select="$indice"/>
				</td>
				<td>
					<xsl:choose>
						<xsl:when test="$code='1'">PRESTAZIONE</xsl:when>
						<xsl:when test="$code='2'">Farmaco</xsl:when>			
						<xsl:when test="$code='3'">Consulenza</xsl:when>
						<xsl:when test="$code='4'">Osservazione</xsl:when>
						<xsl:when test="$code='5'">Altro</xsl:when>
						<xsl:when test="$code='6'">Rifiuta trasporto assistito </xsl:when>			
						<xsl:otherwise>Altro</xsl:otherwise>
					</xsl:choose>
				</td>
				<td>
					<xsl:value-of select="$item_name"/>
				</td>
				<td>
					<xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template>
				</td>						
			</tr>
			<xsl:call-template name="rpsCiclaRifiuti">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="rpsCiclaRifiutiDichiarazioni">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:text"/>		
		<xsl:variable name="code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:code/@code"/>		
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:effectiveTime/@value"/>		
		<xsl:variable name="item_operator" select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family/text(),' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given/text())"/>
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt;= $count">

			<tr class="">
				<td class="">
					<xsl:value-of select="$indice"/>
				</td>
				<td>
					<xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template>
				</td>			
				<td>
					<xsl:value-of select="$item_name"/>
				</td>
				<td style="display: block; word-break: break-all; max-width: 365px;">
					<xsl:value-of select="$item_operator"/>
				</td>									
			</tr>
			<xsl:call-template name="rpsCiclaRifiutiDichiarazioni">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="rpsCiclaOperatori">
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_name" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:text"/>		
		<xsl:variable name="code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:code/@code"/>		
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='RIFIUTI_DICHIARAZIONI']/n1:component/n1:section[@ID='DICHIARAZIONI']/n1:entry[$indice]/n1:act/n1:effectiveTime/@value"/>		
		<xsl:variable name="position" select="$count - $indice"/>
		<xsl:if test="$indice &lt;= $count">
			<tr class="">
				<td class="">
					<xsl:value-of select="$indice"/>
				</td>
				<td>
					<xsl:choose>
						<xsl:when test="$code='1'">PRESTAZIONE</xsl:when>
						<xsl:when test="$code='2'">Farmaco</xsl:when>			
						<xsl:when test="$code='3'">Consulenza</xsl:when>
						<xsl:when test="$code='4'">Osservazione</xsl:when>
						<xsl:when test="$code='5'">Altro</xsl:when>
						<xsl:when test="$code='6'">Rifiuta trasporto assistito </xsl:when>			
						<xsl:otherwise>Altro</xsl:otherwise>
					</xsl:choose>
				</td>
				<td>
					<xsl:value-of select="$item_name"/>
				</td>
				<td>
					<xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template>
				</td>						
			</tr>
			<xsl:call-template name="rpsCiclaRifiutiDichiarazioni">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="ciclaPrestazioniRPS">		
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:param name="type" select="PRESTATIONI_EROGATE"/>
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:procedure/n1:effectiveTime/@value"/>
		<xsl:variable name="item_quantity" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:procedure/n1:entryRelationship/n1:supply/n1:quantity/@value"/>		
		<xsl:variable name="item_code" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:procedure/n1:code/@code"/>
		<xsl:variable name="item_displayName" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:procedure/n1:code/@displayName"/>		
		<xsl:variable name="item_indicaz" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:procedure/n1:text/text()"/>
		<xsl:if test="$indice &lt;= $count">			
			<xsl:call-template name="rpsPrestazioniIntestazione">
				<xsl:with-param name="item" select="$indice"/>
				<xsl:with-param name="type" select="$type"/>
			</xsl:call-template>
			<tr>
	          <td style="padding:0 0 0 10px"><xsl:call-template name="formatTimestampLong">

						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template></td>
	          <td><xsl:value-of select="$item_code"/> - <xsl:value-of select="$item_displayName"/></td>
	          <td><xsl:value-of select="$item_indicaz"/></td>
	          <td><xsl:value-of select="$item_quantity"/></td>
	        </tr>
			<xsl:call-template name="ciclaPrestazioniRPS">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="type" select="$type"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="ciclaDiarioRPS">
		<xsl:param name="count" select="0"/>
		<xsl:param name="type" select="DIARIO_CLINICO"/>
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:act/n1:effectiveTime/@value"/>
		<xsl:variable name="item" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:act/n1:text"/>
		<xsl:variable name="item_operator" select="concat(/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:act/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family/text(),' ',/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$indice]/n1:act/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given/text())"/>		
		<xsl:if test="$indice &lt;= $count">
			<tr>
	          <td><xsl:value-of select="$indice"/></td>
	          <td><xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template></td>
	          <td><xsl:value-of select="$item"/></td>
	          <td style="display: block; word-break: break-all; max-width: 365px;"><xsl:value-of select="$item_operator"/></td>
	        </tr>
			<xsl:call-template name="ciclaDiarioRPS">				
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="type" select="$type"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="ciclaFrattureRPS">
		<xsl:param name="count" select="0" />
		<xsl:param name="indice" select="1"/>
		<xsl:variable name="item_time" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FRATTURE']/n1:entry[$indice]/n1:act/n1:effectiveTime/@value"/>
		<xsl:variable name="item" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID='FRATTURE']/n1:entry[$indice]/n1:act/n1:text"/>
		<xsl:if test="$indice &lt;= $count">
			<tr>
	          <td><xsl:value-of select="$indice"/></td>
	          <td><xsl:call-template name="formatTimestampLong">
						<xsl:with-param name="date" select="$item_time"/>
					</xsl:call-template></td>
	          <td><xsl:value-of select="$item"/></td>
	          <td></td>
	        </tr>
			<xsl:call-template name="ciclaFrattureRPS">
				<xsl:with-param name="count" select="$count"/>
				<xsl:with-param name="indice" select="$indice + 1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>	
	<xsl:template name="rpsPrestazioniIntestazione">
		<xsl:param name="item" select="1"/>
		<xsl:param name="type" select="PRESTAZIONI_EROGATE"/>
		<xsl:variable name="item_minus" select="$item - 1"/>
		<xsl:variable name="all" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$item]/n1:procedure/n1:participant/n1:participantRole/n1:scopingEntity/n1:desc/text()"/>
		<xsl:variable name="previous" select="/n1:ClinicalDocument/n1:component/n1:structuredBody/n1:component/n1:section[@ID=$type]/n1:entry[$item_minus]/n1:procedure/n1:participant/n1:participantRole/n1:scopingEntity/n1:desc/text()"/>
		<xsl:variable name="istituto" select="substring-before($all,'\')"/>
		<xsl:variable name="stabilimento" select="substring-before(substring($all,string-length($istituto)+2),'\')"/>	
		<xsl:variable name="reparto" select="substring-after(substring($all,string-length($istituto)+2),'\')"/>	
		<xsl:if test="$all!=$previous or $item=1">
			<tr>
		      <td><strong>ISTITUTO:</strong></td>
		      <td><xsl:value-of select="$istituto"/></td>
		      <td> </td>
		      <td> </td>
		    </tr>
		    <tr>
		      <td><strong>STABILIMENTO:</strong></td>
		      <td><xsl:value-of select="$stabilimento"/></td>
		      <td> </td>
		      <td> </td>
		    </tr>
		    <tr>
		      <td><strong>REPARTO:</strong></td>
		      <td><xsl:value-of select="$reparto"/></td>
		      <td> </td>
		      <td> </td>
		    </tr>
			<tr>
              <td style="padding:0 0 0 10px"><strong>DATA E ORA</strong></td>
              <td><strong>CODICE - DESCRIZIONE<strong></strong></strong></td>
              <td><strong>INDICAZIONE</strong></td>
              <td><strong>Q.TA'</strong></td>
        	</tr>
		</xsl:if>
	</xsl:template>
	<xsl:template name="elapsed-time">
	    <xsl:param name="start"/>
		<xsl:param name="end"/>
		<xsl:variable name="yy1" select="substring($start, 1, 4)" />
	    <xsl:variable name="mm1" select="substring($start, 5, 2)" />
		<xsl:variable name="dd1" select="substring($start, 7, 2)" />
		<xsl:variable name="h1" select="substring($start, 9, 2)" />
		<xsl:variable name="m1" select="substring($start, 11, 2)" />	
		<xsl:variable name="yy2" select="substring($end, 1, 4)" />
	    <xsl:variable name="mm2" select="substring($end, 5, 2)" />	
		<xsl:variable name="dd2" select="substring($end, 7, 2)" />
		<xsl:variable name="h2" select="substring($end, 9, 2)" />
		<xsl:variable name="m2" select="substring($end, 11, 2)" />
		<xsl:variable name="hh" select="number($h2)-number($h1)" />
		<xsl:choose>
		<xsl:when test="number($m2) >= number($m1)">
			<xsl:variable name="mm" select="number($m2)-number($m1)"/>
			<xsl:value-of select="concat(format-number($hh, '00'),format-number($mm, ':00'))"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:variable name="substract" select="number($m1) - number($m2)"/>			
			<xsl:value-of select="concat(format-number($hh - 1, '00'),format-number(60 - $substract, ':00'))"/>
		</xsl:otherwise>
		</xsl:choose>	    
	</xsl:template>
	<xsl:template name="rpsParametriVitali">
		<xsl:param name="item"/>	
		<xsl:param name="type"/>
		<xsl:param name="count" select="0"/>
		<xsl:param name="indice" select="1"/>
		<xsl:if test="$indice=1">
			<tr>
              <th>FC<br/>
                [bpm]</th>
              <th>PA [mmHG]<br/>
                max/min</th>
              <th>TC<br/>
                [°C]</th>
              <th>HGT</th>
              <th>SP02<br/>
                [%]</th>
              <th>SP02 AA<br/>
                [%]</th>
			  <th>SP02 02<br/>
                [%]</th>
              <th>DURATA<br/>
                SINTOMI</th>
              <th>DEAMBULAZ.</th>
              <th>FR<br/>
                [arpm]</th>
              <th>AVPU</th>
              <th>GCS</th>
              <th>CPSS</th>
              <th>RTS</th>
              <th>OPERATORE</th>
            </tr>
		</xsl:if>
		<xsl:if test="$indice &lt;= $count">            
            <xsl:if test="$type='PARAMETRI_VITALI' or $type='PARAMETRI_VITALI_OB'">
			<tr>
				<td colspan="10"><strong>DATA RILEVAZIONE:</strong><xsl:call-template name="formatTimestampLong"><xsl:with-param name="date" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:effectiveTime/@value"/></xsl:call-template></td>
			</tr>
			</xsl:if>
			<tr>    
			  <td>
			  <xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11328-2']/../n1:value/@value"/>
			  <xsl:variable name="fc_text" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11328-2']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="fc_text_val" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$fc_text]/../n1:caption/text()"/>
			  <xsl:if test="string-length($fc_text_val)>0">
			  	<xsl:value-of select="concat(' ',$fc_text_val)"/>
			  </xsl:if>
			  </td>
              <td>
			  <xsl:if test="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11377-9']/../n1:value/@value">
			  	<xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11377-9']/../n1:value/@value"/>
			  	/<xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11378-7']/../n1:value/@value"/>
			  </xsl:if>
			  </td>
              <td><xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11289-6']/../n1:value/@value"/></td>
              <td><xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='52041-1']/../n1:value/@value"/></td>
              <td></td>              
			  <td>
			  <xsl:for-each select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='2709-4']">
			  	<xsl:variable name="position" select="position()"/>
				<xsl:variable name="nodo" select="./n1:originalText/n1:reference/@value"/>				
				<xsl:variable name="item_name" select="substring($nodo,1,7)"/>
				<xsl:if test="$item_name='SP02_AA' and $nodo=$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$nodo]/@ID"> 				
					<xsl:value-of select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$nodo]/text()"/>
				</xsl:if>				
			  </xsl:for-each>
			  </td>
			  <td>
			  <xsl:for-each select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='2709-4']">
			  	<xsl:variable name="position" select="position()"/>
				<xsl:variable name="nodo" select="./n1:originalText/n1:reference/@value"/>				
				<xsl:variable name="item_name" select="substring($nodo,1,7)"/>
				<xsl:if test="$item_name='SP02_O2' and $nodo=$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$nodo]/@ID"> 
					<xsl:value-of select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$nodo]/text()"/>
				</xsl:if>				
			  </xsl:for-each>
			  </td>
              <td>
			  <xsl:variable name="dssencoded" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='56827-9']/../n1:value/@value"/>
			  <xsl:variable name="dss" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='56827-9']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="dssval" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:caption[@ID=$dss]/../n1:content/text()"/>
			  <xsl:if test="string-length($dssval)>0">			  
			  	<xsl:value-of select="concat('(',$dssencoded,') ',$dssval)"/>
			  </xsl:if>
			  </td>
              <td>
			  <xsl:variable name="deamb" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='46555-9']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="deambval" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:caption[@ID=$deamb]/../n1:content/text()"/>
			  <xsl:value-of select="$deambval"/>
			  </td>
              <td><xsl:value-of select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='11291-2']/../n1:value/@value"/></td>
              <td>
			  <xsl:variable name="avpu" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='67775-7']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="avpuval" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:caption[@ID=$avpu]/../n1:content/text()"/>
			  <xsl:value-of select="substring($avpuval,1,1)"/>
			  </td>
              <td>
			  	<xsl:variable name="gcs" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='9269-2']/n1:originalText/n1:reference/@value"/>
				<xsl:variable name="gcsval" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$gcs]/text()"/>
				<xsl:value-of select="$gcsval"/>
			  </td>
              <td>
			  <xsl:variable name="cpss" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='67522-3']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="cpssval" select="substring($item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:caption[@ID=$cpss]/../n1:content/@ID,1,1)"/>
			  <xsl:value-of select="$cpssval"/>	
			  </td>		  
			  <td>
			  <xsl:variable name="rts" select="$item[$indice]/n1:section/n1:entry/n1:organizer/n1:component/n1:observation/n1:code[@code='eVitals.33']/n1:originalText/n1:reference/@value"/>
			  <xsl:variable name="rtsval" select="$item[$indice]/n1:section/n1:text/n1:list/n1:item/n1:content[@ID=$rts]/text()"/>
			  <xsl:value-of select="$rtsval"/>
			  </td>
              <td style="display:block;max-width:86px;word-break:break-all;"><xsl:value-of select="concat($item[$indice]/n1:section/n1:entry/n1:organizer/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:family/text(),' ',$item[$indice]/n1:section/n1:entry/n1:organizer/n1:performer/n1:assignedEntity/n1:assignedPerson/n1:name/n1:given/text())"/></td>
            </tr>          
		<xsl:call-template name="rpsParametriVitali">
			<xsl:with-param name="item" select="$item"/>
			<xsl:with-param name="type" select="$type"/>
			<xsl:with-param name="count" select="$count"/>
			<xsl:with-param name="indice" select="$indice + 1"/>
		</xsl:call-template>
		</xsl:if>		
	</xsl:template>	
<!-- lantana start -->
<!-- generate table of contents -->
  <xsl:template name="make-tableofcontents">
    <nav class="cda-render hidden-print hidden-xs hidden-sm affix toc-box" id="navbar-cda">
      <ul class="cda-render nav nav-stacked fixed" id="navbar-list-cda">
        <li>
          <a class="cda-render lantana-toc" href="#top">Intestazione</a>
        </li>
        <li>
          <a class="cda-render lantana-toc" href="#cda-patient">Dati paziente</a>
        </li>
        <li>
          <a class="cda-render lantana-toc" href="#author-performer">Autore</a>
        </li>
        <li>
          <a class="cda-render lantana-toc bold" href="#doc-clinical-info">Sezioni cliniche</a>
          <ul class="cda-render nav nav-stacked fixed" id="navbar-list-cda-sortable">
            <xsl:for-each select="n1:component/n1:structuredBody/n1:component/n1:section/n1:title">
              <li>
                <a class="cda-render lantana-toc" href="#{generate-id(.)}">
                  <xsl:value-of select="."/>
                </a>
              </li>
            </xsl:for-each>
          </ul>
        </li>
        <li>
          <a class="cda-render lantana-toc" href="#doc-info">Firme</a>
        </li>
      </ul>
    </nav>
  </xsl:template>
  <!-- header elements -->
  <xsl:template name="documentGeneral">
    <div class="container-fluid">
      <h2 class="section-title col-md-8">
        <xsl:text>Informazioni documento</xsl:text>
      </h2>
      <div class="table-responsive col-md-8">
        <table class="table table-hover">
          <thead>
            <tr>
              <th>
                <xsl:text>Identificativo Documento</xsl:text>
              </th>
              <th>
                <xsl:text>Data creazione</xsl:text>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>
                <xsl:call-template name="show-id">
                  <xsl:with-param name="id" select="n1:id"/>
                </xsl:call-template>
              </td>
              <td>
                <xsl:call-template name="show-time">
                  <xsl:with-param name="datetime" select="n1:effectiveTime"/>
                </xsl:call-template>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </xsl:template>
  <!-- confidentiality -->
  <xsl:template name="confidentiality">
    <table class="header_table">
      <tbody>
        <td class="td_header_role_name">
          <xsl:text>Riservatezza</xsl:text>
        </td>
        <td class="td_header_role_value">
          <xsl:choose>
            <xsl:when test="n1:confidentialityCode/@code = &apos;N&apos;">
              <xsl:text>Normale</xsl:text>
            </xsl:when>
            <xsl:when test="n1:confidentialityCode/@code = &apos;R&apos;">
              <xsl:text>Limitato</xsl:text>
            </xsl:when>
            <xsl:when test="n1:confidentialityCode/@code = &apos;V&apos;">
              <xsl:text>Molto limitato</xsl:text>
            </xsl:when>
          </xsl:choose>
          <xsl:if test="n1:confidentialityCode/n1:originalText">
            <xsl:text> </xsl:text>
            <xsl:value-of select="n1:confidentialityCode/n1:originalText"/>
          </xsl:if>
        </td>
      </tbody>
    </table>
  </xsl:template>
  <!-- author -->
  <xsl:template name="author">
    <xsl:if test="n1:author">
      <div class="header container-fluid">
        <xsl:for-each select="n1:author/n1:assignedAuthor">
          <div class="container-fluid">
            <div class="col-md-8">
              <h2 class="section-title col-md-8" id="author-performer">
                <xsl:text>Autore</xsl:text>
              </h2>
              <div class="header-group-content col-md-8">
                <xsl:choose>
                  <xsl:when test="n1:assignedPerson/n1:name">
                    <xsl:call-template name="show-name">
                      <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
                    </xsl:call-template>
                    <xsl:if test="n1:representedOrganization">
                      <xsl:text> - </xsl:text>
                      <xsl:call-template name="show-name">
                        <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
                      </xsl:call-template>
                    </xsl:if>
                  </xsl:when>
                  <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code"
                        select="n1:assignedAuthoringDevice/n1:softwareName"/>
                    </xsl:call-template>

                  </xsl:when>
                  <xsl:when test="n1:representedOrganization">
                    <xsl:call-template name="show-name">
                      <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
                    </xsl:call-template>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:for-each select="n1:id">
                      <xsl:call-template name="show-id">
                        <xsl:with-param name="id" select="."/>
                      </xsl:call-template>
                    </xsl:for-each>
                  </xsl:otherwise>
                </xsl:choose>
              </div>
            </div>
            <div class="col-md-4">
              <xsl:if test="n1:addr | n1:telecom">
                <h2 class="section-title col-md-8">Contatto</h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-contactInfo">
                    <xsl:with-param name="contact" select="."/>
                  </xsl:call-template>
                </div>
              </xsl:if>
            </div>
          </div>
        </xsl:for-each>
      </div>
    </xsl:if>
  </xsl:template>
  <!--  authenticator -->
  <xsl:template name="authenticator">
    <xsl:if test="n1:authenticator">
      <div class="header container-fluid">
        <xsl:for-each select="n1:authenticator">
          <div class="col-md-8">
            <h2 class="section-title col-md-8">
              <xsl:text>Firmato</xsl:text>
            </h2>
            <div class="header-group-content col-md-8">
              <xsl:call-template name="show-name">
                <xsl:with-param name="name" select="n1:assignedEntity/n1:assignedPerson/n1:name"/>
              </xsl:call-template>
              <xsl:text> alle </xsl:text>
              <xsl:call-template name="show-time">
                <xsl:with-param name="datetime" select="n1:time"/>
              </xsl:call-template>
            </div>
          </div>
          <div class="col-md-4">
            <xsl:if test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
              <h2 class="section-title col-md-8">
                <xsl:text>Contatto</xsl:text>
              </h2>
              <div class="header-group-content col-md-8">
                <xsl:call-template name="show-contactInfo">
                  <xsl:with-param name="contact" select="n1:assignedEntity"/>
                </xsl:call-template>
              </div>
            </xsl:if>
          </div>
        </xsl:for-each>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- legalAuthenticator -->
  <xsl:template name="legalAuthenticator">
    <div class="container-fluid">
      <xsl:if test="n1:legalAuthenticator">
        <div class="header container-fluid">
          <div class="col-md-8">
            <h2 class="section-title col-md-8">
              <xsl:text>Autenticatore Legale</xsl:text>
            </h2>
            <div class="header-group-content col-md-8">
              <xsl:call-template name="show-assignedEntity">
                <xsl:with-param name="asgnEntity" select="n1:legalAuthenticator/n1:assignedEntity"/>
              </xsl:call-template>
              <xsl:text> </xsl:text>
              <xsl:call-template name="show-sig">
                <xsl:with-param name="sig" select="n1:legalAuthenticator/n1:signatureCode"/>
              </xsl:call-template>
              <xsl:if test="n1:legalAuthenticator/n1:time/@value">
                <xsl:text> il </xsl:text>
                <xsl:call-template name="show-time">
                  <xsl:with-param name="datetime" select="n1:legalAuthenticator/n1:time"/>
                </xsl:call-template>
              </xsl:if>
            </div>
          </div>
          <xsl:if
            test="n1:legalAuthenticator/n1:assignedEntity/n1:addr | n1:legalAuthenticator/n1:assignedEntity/n1:telecom">
            <div class="col-md-4">
              <h2 class="col-md-8 section-title">Contatto</h2>
              <div class="header-group-content col-md-8">
                <xsl:call-template name="show-contactInfo">
                  <xsl:with-param name="contact" select="n1:legalAuthenticator/n1:assignedEntity"/>
                </xsl:call-template>
              </div>
            </div>
          </xsl:if>
        </div>
      </xsl:if>
    </div>
  </xsl:template>
  <!-- dataEnterer -->
  <xsl:template name="dataEnterer">
    <xsl:if test="n1:dataEnterer">
      <div class="container-fluid header">
        <div class="col-md-8">
          <h2 class="section-title col-md-8">
            <xsl:text>Editato da </xsl:text>
          </h2>
          <div class="col-md-8 header-group-content">
            <xsl:call-template name="show-assignedEntity">
              <xsl:with-param name="asgnEntity" select="n1:dataEnterer/n1:assignedEntity"/>
            </xsl:call-template>
          </div>
        </div>
        <div class="col-md-4">
          <xsl:if
            test="n1:dataEnterer/n1:assignedEntity/n1:addr | n1:dataEnterer/n1:assignedEntity/n1:telecom">
            <h2 class="section-title col-md-8">
              <xsl:text>Contatto</xsl:text>
            </h2>
            <div class="col-md-8 header-group-content">
              <xsl:call-template name="show-contactInfo">
                <xsl:with-param name="contact" select="n1:dataEnterer/n1:assignedEntity"/>
              </xsl:call-template>
            </div>
          </xsl:if>
        </div>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- componentOf -->
  <xsl:template name="componentOf">
    <xsl:if test="n1:componentOf">
      <div class="header container-fluid">
        <xsl:for-each select="n1:componentOf/n1:encompassingEncounter">
          <div class="container-fluid col-md-8">
            <div class="container-fluid">
              <h2 class="section-title col-md-8">
                <xsl:text>Visita</xsl:text>
              </h2>
              <div class="header-group-content col-md-8">
                <xsl:if test="n1:id">
                  <xsl:choose>
                    <xsl:when test="n1:code">
                      <div class="row">
                        <div class="attribute-title col-md-4">
                          <xsl:text>Identificatore</xsl:text>
                        </div>
                        <div class="col-md-4">
                          <xsl:call-template name="show-id">
                            <xsl:with-param name="id" select="n1:id"/>
                          </xsl:call-template>
                        </div>
                      </div>
                      <div class="row">
                        <div class="attribute-title col-md-4">
                          <xsl:text>Tipo</xsl:text>
                        </div>
                        <div class="col-md-4">
                          <xsl:call-template name="show-code">
                            <xsl:with-param name="code" select="n1:code"/>
                          </xsl:call-template>
                        </div>
                      </div>
                    </xsl:when>
                    <xsl:otherwise>
                      <div class="row">
                        <div class="attribute-title col-md-4">
                          <xsl:text>Identificatore</xsl:text>
                        </div>
                        <div class="col-md-4">
                          <xsl:call-template name="show-id">
                            <xsl:with-param name="id" select="n1:id"/>
                          </xsl:call-template>
                        </div>
                      </div>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:if>
                <div class="row">
                  <div class="attribute-title col-md-4">
                    <xsl:text>Data</xsl:text>
                  </div>
                  <xsl:if test="n1:effectiveTime">
                    <xsl:choose>
                      <xsl:when test="n1:effectiveTime/@value">
                        <div class="col-md-4">
                          <xsl:call-template name="show-time">
                            <xsl:with-param name="datetime" select="n1:effectiveTime"/>
                          </xsl:call-template>
                        </div>
                      </xsl:when>
                      <xsl:when test="n1:effectiveTime/n1:low">
                        <div class="col-md-4">
                          <span class="attribute-title">
                            <xsl:text>Da: </xsl:text>
                          </span>
                          <xsl:call-template name="show-time">
                            <xsl:with-param name="datetime" select="n1:effectiveTime/n1:low"/>
                          </xsl:call-template>
                        </div>
                        <xsl:if test="n1:effectiveTime/n1:high">
                          <div class="col-md-4">
                            <span class="attribute-title">
                              <xsl:text>A: </xsl:text>
                            </span>
                            <xsl:call-template name="show-time">
                              <xsl:with-param name="datetime" select="n1:effectiveTime/n1:high"/>
                            </xsl:call-template>
                          </div>
                        </xsl:if>
                      </xsl:when>
                    </xsl:choose>
                  </xsl:if>
                </div>
                <xsl:if test="n1:location/n1:healthCareFacility">
                  <div class="row">
                    <div class="attribute-title col-md-4">
                      <xsl:text>Location</xsl:text>
                    </div>
                    <div class="col-md-4">
                      <xsl:choose>
                        <xsl:when test="n1:location/n1:healthCareFacility/n1:location/n1:name">
                          <xsl:call-template name="show-name">
                            <xsl:with-param name="name"
                              select="n1:location/n1:healthCareFacility/n1:location/n1:name"/>
                          </xsl:call-template>
                          <xsl:for-each
                            select="n1:location/n1:healthCareFacility/n1:serviceProviderOrganization">
                            <xsl:if test="n1:name">
								<xsl:text> di </xsl:text>
								<xsl:call-template name="show-name">
									<xsl:with-param name="name" select="n1:name"/>
								</xsl:call-template>
							</xsl:if>
                          </xsl:for-each>
                        </xsl:when>
                        <xsl:when test="n1:location/n1:healthCareFacility/n1:code">
                          <xsl:call-template name="show-code">
                            <xsl:with-param name="code"
                              select="n1:location/n1:healthCareFacility/n1:code"/>
                          </xsl:call-template>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:if test="n1:location/n1:healthCareFacility/n1:id">
                            <span class="attribute-title">
                              <xsl:text>ID: </xsl:text>
                            </span>
                            <xsl:for-each select="n1:location/n1:healthCareFacility/n1:id">
                              <xsl:call-template name="show-id">
                                <xsl:with-param name="id" select="."/>
                              </xsl:call-template>
                            </xsl:for-each>
                          </xsl:if>
                        </xsl:otherwise>
                      </xsl:choose>
                    </div>
                  </div>
                </xsl:if>
              </div>
              <xsl:if test="n1:responsibleParty">
                <div class="col-md-8">
                  <h2 class="section-title col-md-8">
                    <xsl:text>Parte responsabile</xsl:text>
                  </h2>
                  <div class="header-group-content col-md-8">
                    <xsl:call-template name="show-assignedEntity">
                      <xsl:with-param name="asgnEntity"
                        select="n1:responsibleParty/n1:assignedEntity"/>
                    </xsl:call-template>
                  </div>
                </div>
              </xsl:if>
              <xsl:if
                test="n1:responsibleParty/n1:assignedEntity/n1:addr | n1:responsibleParty/n1:assignedEntity/n1:telecom">
                <div class="col-md-4">
                  <h2 class="section-title col-md-8">
                    <xsl:text>Contatto</xsl:text>
                  </h2>
                  <div class="header-group-content col-md-8">
                    <xsl:call-template name="show-contactInfo">
                      <xsl:with-param name="contact" select="n1:responsibleParty/n1:assignedEntity"
                      />
                    </xsl:call-template>
                  </div>
                </div>
              </xsl:if>
            </div>
          </div>
        </xsl:for-each>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- custodian -->
  <xsl:template name="custodian">
    <xsl:if test="n1:custodian">
      <div class="container-fluid header">
        <div class="col-md-8">
          <h2 class="section-title col-md-8">
            <xsl:text>Documento memorizzato in</xsl:text>
          </h2>
          <div class="header-group-content col-md-8">
            <xsl:choose>
              <xsl:when
                test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name">
                <xsl:call-template name="show-name">
                  <xsl:with-param name="name"
                    select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:name"
                  />
                </xsl:call-template>
              </xsl:when>
              <xsl:otherwise>
                <xsl:for-each
                  select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:id">
                  <xsl:call-template name="show-id"/>
                  <xsl:if test="position() != last()"> </xsl:if>
                </xsl:for-each>
              </xsl:otherwise>
            </xsl:choose>
          </div>
        </div>
        <xsl:if
          test="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:addr | n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization/n1:telecom">
          <div class="col-md-4">
            <h2 class="section-title col-md-8"> Contatto </h2>
            <div class="header-group-content col-md-8">
              <xsl:call-template name="show-contactInfo">
                <xsl:with-param name="contact"
                  select="n1:custodian/n1:assignedCustodian/n1:representedCustodianOrganization"/>
              </xsl:call-template>
            </div>
          </div>
        </xsl:if>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- documentationOf -->
  <xsl:template name="documentationOf">
    <xsl:if test="n1:documentationOf">
      <div class="header container-fluid">
        <xsl:for-each select="n1:documentationOf">
          <xsl:if test="n1:serviceEvent/@classCode and n1:serviceEvent/n1:code">
            <div class="container-fluid">
              <div class="container-fluid">
                <xsl:variable name="displayName">
                  <xsl:call-template name="show-actClassCode">
                    <xsl:with-param name="clsCode" select="n1:serviceEvent/@classCode"/>
                  </xsl:call-template>
                </xsl:variable>
                <xsl:if test="$displayName">
                  <div class="col-md-6">
                    <h2 class="section-title">
                      <xsl:call-template name="firstCharCaseUp">
                        <xsl:with-param name="data" select="$displayName"/>
                      </xsl:call-template>
                    </h2>
                  </div>
                  <div class="header-group-content col-md-6">
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code" select="n1:serviceEvent/n1:code"/>
                    </xsl:call-template>
                    <xsl:if test="n1:serviceEvent/n1:effectiveTime">
                      <xsl:choose>
                        <xsl:when test="n1:serviceEvent/n1:effectiveTime/@value">
                          <xsl:text>&#160;at&#160;</xsl:text>
                          <xsl:call-template name="show-time">
                            <xsl:with-param name="datetime"
                              select="n1:serviceEvent/n1:effectiveTime"/>
                          </xsl:call-template>
                        </xsl:when>
                        <xsl:when test="n1:serviceEvent/n1:effectiveTime/n1:low">
                          <xsl:text>&#160;da&#160;</xsl:text>
                          <xsl:call-template name="show-time">
                            <xsl:with-param name="datetime"
                              select="n1:serviceEvent/n1:effectiveTime/n1:low"/>
                          </xsl:call-template>
                          <xsl:if test="n1:serviceEvent/n1:effectiveTime/n1:high">
                            <xsl:text> a </xsl:text>
                            <xsl:call-template name="show-time">
                              <xsl:with-param name="datetime"
                                select="n1:serviceEvent/n1:effectiveTime/n1:high"/>
                            </xsl:call-template>
                          </xsl:if>
                        </xsl:when>
                      </xsl:choose>
                    </xsl:if>
                  </div>
                </xsl:if>
              </div>
            </div>
          </xsl:if>
          <xsl:for-each select="n1:serviceEvent/n1:performer">
            <div class="header-group container-fluid">
              <xsl:variable name="displayName">
                <xsl:call-template name="show-participationType">
                  <xsl:with-param name="ptype" select="@typeCode"/>
                </xsl:call-template>
                <xsl:if test="n1:functionCode/@code">
                  <xsl:text> </xsl:text>
                  <xsl:call-template name="show-participationFunction">
                    <xsl:with-param name="pFunction" select="n1:functionCode/@code"/>
                  </xsl:call-template>
                </xsl:if>
              </xsl:variable>
              <div class="container-fluid">
                <h2 class="section-title col-md-8" id="service-event">
                  <xsl:text>Evento di servizio</xsl:text>
                </h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-assignedEntity">
                    <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
                  </xsl:call-template>
                </div>
                <div class="header-group-content col-md-8">
                  <xsl:if test="../n1:effectiveTime/n1:low">
                    <xsl:call-template name="show-time">
                      <xsl:with-param name="datetime" select="../n1:effectiveTime/n1:low"/>
                    </xsl:call-template>
                  </xsl:if>
                  <xsl:if test="../n1:effectiveTime/n1:high"> - <xsl:call-template name="show-time">
                      <xsl:with-param name="datetime" select="../n1:effectiveTime/n1:high"/>
                    </xsl:call-template>
                  </xsl:if>
                </div>
              </div>
            </div>
          </xsl:for-each>
        </xsl:for-each>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- inFulfillmentOf -->
  <xsl:template name="inFulfillmentOf">
    <xsl:if test="n1:infulfillmentOf">
      <xsl:for-each select="n1:inFulfillmentOf">
        <xsl:text>In adempimento di</xsl:text>
        <xsl:for-each select="n1:order">
          <xsl:for-each select="n1:id">
            <xsl:call-template name="show-id"/>
          </xsl:for-each>
          <xsl:for-each select="n1:code">
            <xsl:text>&#160;</xsl:text>
            <xsl:call-template name="show-code">
              <xsl:with-param name="code" select="."/>
            </xsl:call-template>
          </xsl:for-each>
          <xsl:for-each select="n1:priorityCode">
            <xsl:text>&#160;</xsl:text>
            <xsl:call-template name="show-code">
              <xsl:with-param name="code" select="."/>
            </xsl:call-template>
          </xsl:for-each>
        </xsl:for-each>
      </xsl:for-each>
    </xsl:if>
  </xsl:template>
  <!-- informant -->
  <xsl:template name="informant">
    <xsl:if test="n1:informant">
      <div class="header container-fluid">
        <xsl:for-each select="n1:informant">
          <div class="container-fluid">
            <div class="col-md-8">
              <h2 class="section-title col-md-8">
                <xsl:text>Informatore</xsl:text>
              </h2>
              <div class="header-group-content col-md-8">
                <xsl:if test="n1:assignedEntity">
                  <xsl:call-template name="show-assignedEntity">
                    <xsl:with-param name="asgnEntity" select="n1:assignedEntity"/>
                  </xsl:call-template>
                </xsl:if>
                <xsl:if test="n1:relatedEntity">
                  <xsl:call-template name="show-relatedEntity">
                    <xsl:with-param name="relatedEntity" select="n1:relatedEntity"/>
                  </xsl:call-template>
                </xsl:if>
              </div>
            </div>
            <xsl:choose>
              <xsl:when test="n1:assignedEntity/n1:addr | n1:assignedEntity/n1:telecom">
                <div class="col-md-4">
                  <h2 class="section-title col-md-8">
                    <xsl:text>Contatto</xsl:text>
                  </h2>
                  <div class="header-group-content col-md-8">
                    <xsl:if test="n1:assignedEntity">
                      <xsl:call-template name="show-contactInfo">
                        <xsl:with-param name="contact" select="n1:assignedEntity"/>
                      </xsl:call-template>
                    </xsl:if>
                  </div>
                </div>
              </xsl:when>
              <xsl:when test="n1:relatedEntity/n1:addr | n1:relatedEntity/n1:telecom">
                <div class="col-md-4">
                  <h2 class="col-md-8 section-title">
                    <xsl:text>Contatto</xsl:text>
                  </h2>
                  <div class="col-md-8 header-group-content">
                    <xsl:if test="n1:relatedEntity">
                      <xsl:call-template name="show-contactInfo">
                        <xsl:with-param name="contact" select="n1:relatedEntity"/>
                      </xsl:call-template>
                    </xsl:if>
                  </div>
                </div>
              </xsl:when>
            </xsl:choose>
          </div>
        </xsl:for-each>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- informantionRecipient -->
  <xsl:template name="informationRecipient">
    <div class="container-fluid">
      <xsl:if test="n1:informationRecipient">
        <div class="container-fluid header">
          <xsl:for-each select="n1:informationRecipient">
            <div class="container-fluid">
              <h2 class="section-title col-md-8">
                <xsl:text>Informazioni destinatario</xsl:text>
              </h2>
              <div class="col-md-8 header-group-content">
                <xsl:choose>
                  <xsl:when test="n1:intendedRecipient/n1:informationRecipient/n1:name">
                    <xsl:for-each select="n1:intendedRecipient/n1:informationRecipient">
                      <xsl:call-template name="show-name">
                        <xsl:with-param name="name" select="n1:name"/>
                      </xsl:call-template>
                      <xsl:if test="position() != last()"> </xsl:if>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:for-each select="n1:intendedRecipient">
                      <xsl:for-each select="n1:id">
                        <xsl:call-template name="show-id"/>
                      </xsl:for-each>
                      <xsl:if test="position() != last()"> </xsl:if>
                    </xsl:for-each>
                  </xsl:otherwise>
                </xsl:choose>
              </div>
              <div class="col-md-4">
                <xsl:if test="n1:intendedRecipient/n1:addr | n1:intendedRecipient/n1:telecom">
                  <h2 class="section-title col-md-8">
                    <xsl:text>Contatto</xsl:text>
                  </h2>
                  <div class="col-md-8">
                    <xsl:call-template name="show-contactInfo">
                      <xsl:with-param name="contact" select="n1:intendedRecipient"/>
                    </xsl:call-template>
                  </div>
                </xsl:if>
              </div>
            </div>
          </xsl:for-each>
        </div>
      </xsl:if>
    </div>
  </xsl:template>
  <!-- participant -->
  <xsl:template name="participant">
    <div class="container-fluid">
      <xsl:if test="n1:participant">
        <div class="header container-fluid">
          <xsl:for-each select="n1:participant">
            <xsl:if
              test="not(n1:associatedEntity/@classCode = 'ECON' or n1:associatedEntity/@classCode = 'NOK')">
              <xsl:variable name="participtRole">
                <xsl:call-template name="translateRoleAssoCode">
                  <xsl:with-param name="classCode" select="n1:associatedEntity/@classCode"/>
                  <xsl:with-param name="code" select="n1:associatedEntity/n1:code"/>
                </xsl:call-template>
              </xsl:variable>
              <div class="col-md-8">
                <h2 class="col-md-8 section-title">
                  <xsl:choose>
                    <xsl:when test="$participtRole">
                      <xsl:call-template name="firstCharCaseUp">
                        <xsl:with-param name="data" select="$participtRole"/>
                      </xsl:call-template>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:text>Partecipante</xsl:text>
                    </xsl:otherwise>
                  </xsl:choose>
                </h2>
                <div class="header-group-content col-md-8">
                  <xsl:if test="n1:functionCode">
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code" select="n1:functionCode"/>
                    </xsl:call-template>
                  </xsl:if>
                  <xsl:call-template name="show-associatedEntity">
                    <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
                  </xsl:call-template>
                  <xsl:if test="n1:time">
                    <xsl:if test="n1:time/n1:low">
                      <xsl:text> da </xsl:text>
                      <xsl:call-template name="show-time">
                        <xsl:with-param name="datetime" select="n1:time/n1:low"/>
                      </xsl:call-template>
                    </xsl:if>
                    <xsl:if test="n1:time/n1:high">
                      <xsl:text> a </xsl:text>
                      <xsl:call-template name="show-time">
                        <xsl:with-param name="datetime" select="n1:time/n1:high"/>
                      </xsl:call-template>
                    </xsl:if>
                  </xsl:if>
                  <xsl:if test="position() != last()">
                    <br/>
                  </xsl:if>
                </div>
              </div>
              <div class="col-md-4">
                <xsl:if test="n1:associatedEntity/n1:addr | n1:associatedEntity/n1:telecom">
                  <h2 class="section-title col-md-8">
                    <xsl:text>Contatto</xsl:text>
                  </h2>
                  <div class="col-md-8 header-group-content">
                    <xsl:call-template name="show-contactInfo">
                      <xsl:with-param name="contact" select="n1:associatedEntity"/>
                    </xsl:call-template>
                  </div>
                </xsl:if>
              </div>
            </xsl:if>
          </xsl:for-each>
        </div>
      </xsl:if>
    </div>
  </xsl:template>
  <!-- recordTarget / Patient -->
  <xsl:template name="recordTarget">
    <div class="header container-fluid" id="cda-patient">
      <xsl:for-each select="/n1:ClinicalDocument/n1:recordTarget/n1:patientRole">
        <xsl:if test="not(n1:id/@nullFlavor)">
          <div class="patient-heading container-fluid">
            <div class="patient-name row">
              <xsl:call-template name="show-name">
                <xsl:with-param name="name" select="n1:patient/n1:name"/>
              </xsl:call-template>
            </div>
            <div class="patient-identifier container-fluid">
              <div class="attribute-title row">Identificatori del paziente</div>
              <xsl:for-each select="n1:id">
                <div class="row">
                  <div class="col-md-8">
                    <xsl:call-template name="show-id"/>
                  </div>
                </div>
              </xsl:for-each>
            </div>
          </div>
          <div class="patient-info container-fluid">
            <div class="col-md-8">
              <h2 class="section-title col-md-8">Dati</h2>
              <div class="header-group-content col-md-8">
                <div class="row">
                  <div class="attribute-title col-md-4">
                    <xsl:text>Data di Nascita</xsl:text>
                  </div>
                  <div class="col-md-4">
                    <xsl:call-template name="formatTimestamp">					
                      <xsl:with-param name="date" select="n1:patient/n1:birthTime/@value"/>
                    </xsl:call-template>
                  </div>
                </div>
                <div class="row">
                  <div class="attribute-title col-md-4">
                    <xsl:text>Sesso</xsl:text>
                  </div>
                  <div class="col-md-4">
                    <xsl:for-each select="n1:patient/n1:administrativeGenderCode">
                      <xsl:call-template name="show-gender"/>
                    </xsl:for-each>
                  </div>
                </div>
                <xsl:if test="n1:patient/n1:raceCode | (n1:patient/n1:ethnicGroupCode)">
                  <div class="row">
                    <div class="attribute-title col-md-4">
                      <xsl:text>Razza</xsl:text>
                    </div>
                    <div class="col-md-4">
                      <xsl:choose>
                        <xsl:when test="n1:patient/n1:raceCode">
                          <xsl:for-each select="n1:patient/n1:raceCode">
                            <xsl:call-template name="show-race-ethnicity"/>
                          </xsl:for-each>
                        </xsl:when>
                        <xsl:otherwise>
                          <span class="generated-text">
                            <xsl:text>Informazione non disponibile</xsl:text>
                          </span>
                        </xsl:otherwise>
                      </xsl:choose>
                    </div>
                  </div>
                  <div class="row">
                    <div class="attribute-title col-md-4">
                      <xsl:text>Etnicità</xsl:text>
                    </div>
                    <div class="col-md-4">
                      <xsl:choose>
                        <xsl:when test="n1:patient/n1:ethnicGroupCode">
                          <xsl:for-each select="n1:patient/n1:ethnicGroupCode">
                            <xsl:call-template name="show-race-ethnicity"/>
                          </xsl:for-each>
                        </xsl:when>
                        <xsl:otherwise>
                          <span class="generated-text">
                            <xsl:text>Informazione non disponibile</xsl:text>
                          </span>
                        </xsl:otherwise>
                      </xsl:choose>
                    </div>
                  </div>
                </xsl:if>
              </div>
            </div>
            <div class="col-md-4">
              <h2 class="section-title col-md-8">
                <xsl:text>Dati di contatto</xsl:text>
              </h2>
              <div class="header-group-content col-md-8">
                <xsl:call-template name="show-contactInfo">
                  <xsl:with-param name="contact" select="."/>
                </xsl:call-template>
              </div>
            </div>
          </div>
        </xsl:if>
      </xsl:for-each>
      <!-- list all the emergency contacts -->
      <xsl:if test="n1:participant">
        <xsl:for-each select="n1:participant">
          <xsl:if test="n1:associatedEntity/@classCode = 'ECON'">
            <div class="container-fluid" id="emergency-contact">
              <div class="col-md-8">
                <h2 class="section-title col-md-8">Dati di contatto di emergenza</h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-associatedEntity">
                    <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
                  </xsl:call-template>
                </div>
              </div>
              <div class="col-md-4">
                <h2 class="section-title col-md-8">Contatto</h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-contactInfo">
                    <xsl:with-param name="contact" select="n1:associatedEntity"/>
                  </xsl:call-template>
                </div>
              </div>
            </div>
          </xsl:if>
        </xsl:for-each>
      </xsl:if>

      <!-- list nex of kin-->
      <xsl:if test="n1:participant">
        <xsl:for-each select="n1:participant">
          <xsl:if test="n1:associatedEntity/@classCode = 'NOK'">
            <div class="container-fluid" id="emergency-contact">
              <div class="col-md-8">
                <h2 class="section-title col-md-8">Famigliare</h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-associatedEntity">
                    <xsl:with-param name="assoEntity" select="n1:associatedEntity"/>
                  </xsl:call-template>
                </div>
              </div>
              <div class="col-md-4">
                <h2 class="section-title col-md-8">Contatto</h2>
                <div class="header-group-content col-md-8">
                  <xsl:call-template name="show-contactInfo">
                    <xsl:with-param name="contact" select="n1:associatedEntity"/>
                  </xsl:call-template>
                </div>
              </div>
            </div>
          </xsl:if>
        </xsl:for-each>
      </xsl:if>
    </div>

  </xsl:template>
  <!-- relatedDocument -->
  <xsl:template name="relatedDocument">
    <xsl:if test="n1:relatedDocument">
      <table class="header_table">
        <tbody>
          <xsl:for-each select="n1:relatedDocument">
            <tr>
              <td class="td_header_role_name">
                <span class="td_label">
                  <xsl:text>Documento collegato</xsl:text>
                </span>
              </td>
              <td class="td_header_role_value">
                <xsl:for-each select="n1:parentDocument">
                  <xsl:for-each select="n1:id">
                    <xsl:call-template name="show-id"/>
                    <br/>
                  </xsl:for-each>
                </xsl:for-each>
              </td>
            </tr>
          </xsl:for-each>
        </tbody>
      </table>
    </xsl:if>
  </xsl:template>
  <!-- authorization (consent) -->
  <xsl:template name="authorization">
    <xsl:if test="n1:authorization">
      <table class="header_table">
        <tbody>
          <xsl:for-each select="n1:authorization">
            <tr>
              <td class="td_header_role_name">
                <span class="td_label">
                  <xsl:text>Consenso</xsl:text>
                </span>
              </td>
              <td class="td_header_role_value">
                <xsl:choose>
                  <xsl:when test="n1:consent/n1:code">
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code" select="n1:consent/n1:code"/>
                    </xsl:call-template>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code" select="n1:consent/n1:statusCode"/>
                    </xsl:call-template>
                  </xsl:otherwise>
                </xsl:choose>
                <br/>
              </td>
            </tr>
          </xsl:for-each>
        </tbody>
      </table>
    </xsl:if>
  </xsl:template>
  <!-- setAndVersion -->
  <xsl:template name="setAndVersion">
    <xsl:if test="n1:setId and n1:versionNumber">
      <table class="header_table">
        <tbody>
          <tr>
            <td class="td_header_role_name">
              <xsl:text>SetId e Version</xsl:text>
            </td>
            <td class="td_header_role_value">
              <xsl:text>SetId: </xsl:text>
              <xsl:call-template name="show-id">
                <xsl:with-param name="id" select="n1:setId"/>
              </xsl:call-template>
              <xsl:text>  Version: </xsl:text>
              <xsl:value-of select="n1:versionNumber/@value"/>
            </td>
          </tr>
        </tbody>
      </table>
    </xsl:if>
  </xsl:template>
  <!-- show StructuredBody  -->
  <xsl:template match="n1:component/n1:structuredBody">
    <xsl:for-each select="n1:component/n1:section">
      <xsl:call-template name="section"/>
    </xsl:for-each>
  </xsl:template>
  <!-- show nonXMLBody -->
  <xsl:template match="n1:component/n1:nonXMLBody">
    <xsl:choose>
      <!-- if there is a reference, use that in an IFRAME -->
      <xsl:when test="n1:text/n1:reference">
        <xsl:variable name="source" select="string(n1:text/n1:reference/@value)"/>
        <xsl:variable name="mediaType" select="string(n1:text/@mediaType)"/>
        <xsl:variable name="lcSource" select="translate($source, $uc, $lc)"/>
        <xsl:variable name="scrubbedSource"
          select="translate($source, $simple-sanitizer-match, $simple-sanitizer-replace)"/>
        <xsl:message><xsl:value-of select="$source"/>, <xsl:value-of select="$lcSource"
          /></xsl:message>
        <xsl:choose>
          <xsl:when test="contains($lcSource, 'javascript')">
            <p>
              <xsl:value-of select="$javascript-injection-warning"/>
            </p>
            <xsl:message>
              <xsl:value-of select="$javascript-injection-warning"/>
            </xsl:message>
          </xsl:when>
          <xsl:when test="not($source = $scrubbedSource)">
            <p>
              <xsl:value-of select="$malicious-content-warning"/>
            </p>
            <xsl:message>
              <xsl:value-of select="$malicious-content-warning"/>
            </xsl:message>
          </xsl:when>
          <xsl:otherwise>
            <iframe name="nonXMLBody" id="nonXMLBody" WIDTH="80%" HEIGHT="600" src="{$source}">
              <html>
                <body>
                  <object data="{$source}" type="{$mediaType}">
                    <embed src="{$source}" type="{$mediaType}"/>
                  </object>
                </body>
              </html>
            </iframe>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:when test='n1:text/@mediaType = "text/plain"'>
        <pre><xsl:value-of select="n1:text/text()"/></pre>
      </xsl:when>
      <xsl:otherwise>
        <pre>Non è possibile visualizzare il testo</pre>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- top level component/section: display title and text,
      and process any nested component/sections
    -->
  <xsl:template name="section">
    <div class="container-fluid header">
	<xsl:choose>
		<xsl:when test="n1:title">
			<xsl:call-template name="section-title">
				<xsl:with-param name="title" select="n1:title"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:call-template name="section-title">
				<xsl:with-param name="title" select="n1:code/@displayName"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>      
      <xsl:call-template name="section-author"/>
      <xsl:call-template name="section-text"/>
	  
	  <xsl:choose>
			<xsl:when test="n1:entry/n1:observationMedia/n1:value[@mediaType='application/pdf']">
			<!-- gnigni -->
			<xsl:variable name="observationMediaValue" select="n1:entry/n1:observationMedia/n1:value"/>
			  <!-- a href="javascript:visualizzaAllegatoPdf()">Visualizza PDF</a -->
			  <!-- a href="javascript:nascondiAllegatoPdf()">Chiudi</a -->
			  <!--a href="javascript:visualizzaAllegatoPdfNuovaPagina(a)">Nuova Pagina</a-->
			  <a download="Allegato.pdf" href="data:application/pdf;base64,{$observationMediaValue}">Scarica Allegato</a>
			  <!--
			  <div id="visualizzaAllegatoPdf" ></div>
			  <div id="visualizzaAllegatoPdfNascosto" style="visibility:hidden;display:none" >
				<object id="pdfViewer" style="width: 100%; height: 100%;" data="data:application/pdf;base64,observationMediaValue" type="application/pdf"></object>
			  </div>
			  -->
			</xsl:when>
	  </xsl:choose>      
	  
      <xsl:for-each select="n1:component/n1:section">
        <div class="container-fluid">
          <xsl:call-template name="nestedSection">
            <xsl:with-param name="margin" select="2"/>
          </xsl:call-template>
        </div>
      </xsl:for-each>
    </div>
  </xsl:template>
  <!-- top level section title -->
  <xsl:template name="section-title">
    <xsl:param name="title"/>
    <h1 class="section-title" id="{generate-id($title)}">
      <xsl:value-of select="$title"/>
    </h1>
  </xsl:template>

  <!-- section author -->
  <xsl:template name="section-author">
    <xsl:if test="count(n1:author) > 0">
      <div class="section-author">
        <span class="emphasis">
          <xsl:text>Sezione Autore:</xsl:text>
        </span>
        <xsl:for-each select="n1:author/n1:assignedAuthor">
          <xsl:choose>
            <xsl:when test="n1:assignedPerson/n1:name">
              <xsl:call-template name="show-name">
                <xsl:with-param name="name" select="n1:assignedPerson/n1:name"/>
              </xsl:call-template>
              <xsl:if test="n1:representedOrganization">
                <xsl:text>, </xsl:text>
                <xsl:call-template name="show-name">
                  <xsl:with-param name="name" select="n1:representedOrganization/n1:name"/>
                </xsl:call-template>
              </xsl:if>
            </xsl:when>
            <xsl:when test="n1:assignedAuthoringDevice/n1:softwareName">
              <xsl:call-template name="show-code">
                <xsl:with-param name="code" select="n1:assignedAuthoringDevice/n1:softwareName"/>
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
              <xsl:for-each select="n1:id">
                <xsl:call-template name="show-id"/>
                <br/>
              </xsl:for-each>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
        <br/>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- top-level section Text   -->
  <xsl:template name="section-text">
    <div class="section-text">
      <xsl:apply-templates select="n1:text"/>
    </div>
  </xsl:template>
  <!-- nested component/section -->
  <xsl:template name="nestedSection">
    <xsl:param name="margin"/>
    <h4>
      <xsl:value-of select="n1:title"/>
    </h4>
    <div class="nested-section" style="margin-left : {$margin}em;">
      <xsl:apply-templates select="n1:text"/>
    </div>
    <xsl:for-each select="n1:component/n1:section">
      <xsl:call-template name="nestedSection">
        <xsl:with-param name="margin" select="2 * $margin"/>
      </xsl:call-template>
    </xsl:for-each>
  </xsl:template>
  <!--   paragraph  -->
  <xsl:template match="n1:paragraph">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>
  <!--   pre format  -->
  <xsl:template match="n1:pre">
    <pre><xsl:apply-templates/></pre>
  </xsl:template>
  <!--   Content w/ deleted text is hidden -->
  <xsl:template match="n1:content[@revised = 'delete']"/>
  <!--   content  -->
  <xsl:template match="n1:content">
    <span>
      <xsl:apply-templates select="@styleCode"/>
      <xsl:apply-templates/>
    </span>
  </xsl:template>
  <!-- line break -->
  <xsl:template match="n1:br">
    <xsl:element name="br">
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>
  <!--   list  -->
  <xsl:template match="n1:list">
    <xsl:if test="n1:caption">
      <p>
        <b>
          <xsl:apply-templates select="n1:caption"/>
        </b>
      </p>
    </xsl:if>
    <ul>
      <xsl:for-each select="n1:item">
        <li>
          <xsl:apply-templates/>
        </li>
      </xsl:for-each>
    </ul>
  </xsl:template>
  <xsl:template match="n1:list[@listType = 'ordered']">
    <xsl:if test="n1:caption">
      <span style="font-weight:bold; ">
        <xsl:apply-templates select="n1:caption"/>
      </span>
    </xsl:if>
    <ol>
      <xsl:for-each select="n1:item">
        <li>
          <xsl:apply-templates/>
        </li>
      </xsl:for-each>
    </ol>
  </xsl:template>
  <!--   caption  -->
  <xsl:template match="n1:caption">
    <xsl:apply-templates/>
    <xsl:text>: </xsl:text>
  </xsl:template>
  <!--  Tables   -->

  <xsl:variable name="table-elem-attrs">
    <in:tableElems>
      <in:elem name="table">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="summary"/>
        <in:attr name="width"/>
        <!-- Commented out to keep table rendering consistent -->
        <!--<in:attr name="border"/>-->
        <in:attr name="frame"/>
        <in:attr name="rules"/>
        <in:attr name="cellspacing"/>
        <in:attr name="cellpadding"/>
      </in:elem>
      <in:elem name="thead">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="tfoot">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="tbody">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="colgroup">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="span"/>
        <in:attr name="width"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="col">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="span"/>
        <in:attr name="width"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="tr">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="th">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="abbr"/>
        <in:attr name="axis"/>
        <in:attr name="headers"/>
        <in:attr name="scope"/>
        <in:attr name="rowspan"/>
        <in:attr name="colspan"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
      <in:elem name="td">
        <in:attr name="ID"/>
        <in:attr name="language"/>
        <in:attr name="styleCode"/>
        <in:attr name="abbr"/>
        <in:attr name="axis"/>
        <in:attr name="headers"/>
        <in:attr name="scope"/>
        <in:attr name="rowspan"/>
        <in:attr name="colspan"/>
        <in:attr name="align"/>
        <in:attr name="char"/>
        <in:attr name="charoff"/>
        <in:attr name="valign"/>
      </in:elem>
    </in:tableElems>
  </xsl:variable>

  <xsl:template name="output-attrs">
    <xsl:variable name="elem-name" select="local-name(.)"/>
    <!-- This assigns all outputted elements the cda-render class -->
    <xsl:attribute name="class">cda-render</xsl:attribute>
    <xsl:choose>
      <xsl:when test="$elem-name = 'table'">
        <xsl:attribute name="class">table table-striped table-hover</xsl:attribute>
      </xsl:when>
     </xsl:choose>
    <xsl:for-each select="@*">
      <xsl:variable name="attr-name" select="local-name(.)"/>
      <xsl:variable name="source" select="."/>
      <xsl:variable name="lcSource" select="translate($source, $uc, $lc)"/>
      <xsl:variable name="scrubbedSource"
        select="translate($source, $simple-sanitizer-match, $simple-sanitizer-replace)"/>
      <xsl:choose>
        <xsl:when test="contains($lcSource, 'javascript')">
          <p>
            <xsl:value-of select="$javascript-injection-warning"/>
          </p>
          <xsl:message terminate="yes">
            <xsl:value-of select="$javascript-injection-warning"/>
          </xsl:message>
        </xsl:when>
        <xsl:when test="$attr-name = 'styleCode'">
          <xsl:apply-templates select="."/>
        </xsl:when>
        <xsl:when
          test="not(document('')/xsl:stylesheet/xsl:variable[@name = 'table-elem-attrs']/in:tableElems/in:elem[@name = $elem-name]/in:attr[@name = $attr-name])">
          <xsl:message><xsl:value-of select="$attr-name"/> non è legale in <xsl:value-of
              select="$elem-name"/></xsl:message>
        </xsl:when>
        <xsl:when test="not($source = $scrubbedSource)">
          <p>
            <xsl:value-of select="$malicious-content-warning"/>
          </p>
          <xsl:message>
            <xsl:value-of select="$malicious-content-warning"/>
          </xsl:message>
        </xsl:when>
        <xsl:otherwise>
          <xsl:copy-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

  <xsl:template match="n1:table">
    <div class="table-responsive">
      <xsl:element name="{local-name()}">
        <xsl:call-template name="output-attrs"/>
        <xsl:apply-templates/>
      </xsl:element>
    </div>
  </xsl:template>

  <xsl:template
    match="n1:thead | n1:tfoot | n1:tbody | n1:colgroup | n1:col | n1:tr | n1:th | n1:td">
    <xsl:element name="{local-name()}">
      <xsl:call-template name="output-attrs"/>
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="n1:table/n1:caption">
    <span style="font-weight:bold; ">
      <xsl:apply-templates/>
    </span>
  </xsl:template>
  <!--   RenderMultiMedia
     this currently only handles GIF's and JPEG's.  It could, however,
     be extended by including other image MIME types in the predicate
     and/or by generating <object> or <applet> tag with the correct
     params depending on the media type  @ID  =$imageRef  referencedObject
     -->
  <xsl:template name="check-external-image-whitelist">
    <xsl:param name="current-whitelist"/>
    <xsl:param name="image-uri"/>
    <xsl:choose>
      <xsl:when test="string-length($current-whitelist) > 0">
        <xsl:variable name="whitelist-item">
          <xsl:choose>
            <xsl:when test="contains($current-whitelist, '|')">
              <xsl:value-of select="substring-before($current-whitelist, '|')"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$current-whitelist"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="starts-with($image-uri, $whitelist-item)">
            <br clear="all"/>
            <xsl:element name="img">
              <xsl:attribute name="src">
                <xsl:value-of select="$image-uri"/>
              </xsl:attribute>
            </xsl:element>
            <xsl:message><xsl:value-of select="$image-uri"/> è nella lista whitelist</xsl:message>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="check-external-image-whitelist">
              <xsl:with-param name="current-whitelist"
                select="substring-after($current-whitelist, '|')"/>
              <xsl:with-param name="image-uri" select="$image-uri"/>
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>

      </xsl:when>
      <xsl:otherwise>
        <p>ATTENZIONE: l'immagine non locale trovata <xsl:value-of select="$image-uri"/>. Rimozione. Se desideri conservare
           le immagini non locali si prega di impostare il parametro limit-external-images a 'no'.</p>
        <xsl:message>ATTENZIONE: l'immagine non locale trovata <xsl:value-of select="$image-uri"/>. Rimozione.
           Se lo si desidera immagini non locali conservati si prega di impostare il parametro limit-external-images  a
           'no'.</xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="n1:renderMultiMedia">
    <xsl:variable name="imageRef" select="@referencedObject"/>
    <xsl:choose>
      <xsl:when test="//n1:regionOfInterest[@ID = $imageRef]">
        <!-- Here is where the Region of Interest image referencing goes -->
        <xsl:if
          test="
            //n1:regionOfInterest[@ID = $imageRef]//n1:observationMedia/n1:value[@mediaType = 'image/gif' or
            @mediaType = 'image/jpeg']">
          <xsl:variable name="image-uri"
            select="//n1:regionOfInterest[@ID = $imageRef]//n1:observationMedia/n1:value/n1:reference/@value"/>
          <xsl:choose>
            <xsl:when
              test="$limit-external-images = 'yes' and (contains($image-uri, ':') or starts-with($image-uri, '\\'))">
              <xsl:call-template name="check-external-image-whitelist">
                <xsl:with-param name="current-whitelist" select="$external-image-whitelist"/>
                <xsl:with-param name="image-uri" select="$image-uri"/>
              </xsl:call-template>              
            </xsl:when>            
            <xsl:otherwise>
              <br clear="all"/>
              <xsl:element name="img">
                <xsl:attribute name="src">
                  <xsl:value-of select="$image-uri"/>
                </xsl:attribute>
              </xsl:element>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <!-- Here is where the direct MultiMedia image referencing goes -->
        <xsl:if
          test="//n1:observationMedia[@ID = $imageRef]/n1:value[@mediaType = 'image/gif' or @mediaType = 'image/jpeg']">
          <br clear="all"/>
          <xsl:element name="img">
            <xsl:attribute name="src">
              <xsl:value-of
                select="//n1:observationMedia[@ID = $imageRef]/n1:value/n1:reference/@value"/>
            </xsl:attribute>
          </xsl:element>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--    Stylecode processing Supports Bold, Underline and Italics display -->
  <xsl:template match="@styleCode">
    <xsl:attribute name="class">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:template>
  <!-- REMOVE HERE -->
  <xsl:template match="//n1:*[@styleCode]">
    <xsl:if test="@styleCode = 'Bold'">
      <xsl:element name="b">
        <xsl:apply-templates/>
      </xsl:element>
    </xsl:if>
    <xsl:if test="@styleCode = 'Italics'">
      <xsl:element name="i">
        <xsl:apply-templates/>
      </xsl:element>
    </xsl:if>
    <xsl:if test="@styleCode = 'Underline'">
      <xsl:element name="u">
        <xsl:apply-templates/>
      </xsl:element>
    </xsl:if>
    <xsl:if
      test="contains(@styleCode, 'Bold') and contains(@styleCode, 'Italics') and not(contains(@styleCode, 'Underline'))">
      <xsl:element name="b">
        <xsl:element name="i">
          <xsl:apply-templates/>
        </xsl:element>
      </xsl:element>
    </xsl:if>
    <xsl:if
      test="contains(@styleCode, 'Bold') and contains(@styleCode, 'Underline') and not(contains(@styleCode, 'Italics'))">
      <xsl:element name="b">
        <xsl:element name="u">
          <xsl:apply-templates/>
        </xsl:element>
      </xsl:element>
    </xsl:if>
    <xsl:if
      test="contains(@styleCode, 'Italics') and contains(@styleCode, 'Underline') and not(contains(@styleCode, 'Bold'))">
      <xsl:element name="i">
        <xsl:element name="u">
          <xsl:apply-templates/>
        </xsl:element>
      </xsl:element>
    </xsl:if>
    <xsl:if
      test="contains(@styleCode, 'Italics') and contains(@styleCode, 'Underline') and contains(@styleCode, 'Bold')">
      <xsl:element name="b">
        <xsl:element name="i">
          <xsl:element name="u">
            <xsl:apply-templates/>
          </xsl:element>
        </xsl:element>
      </xsl:element>
    </xsl:if>
    <xsl:if
      test="not(contains(@styleCode, 'Italics') or contains(@styleCode, 'Underline') or contains(@styleCode, 'Bold'))">
      <xsl:apply-templates/>
    </xsl:if>
  </xsl:template>
  <!-- END REMOVE HERE -->
  <!-- Superscript or Subscript -->
  <xsl:template match="n1:sup">
    <xsl:element name="sup">
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>
  <xsl:template match="n1:sub">
    <xsl:element name="sub">
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>
  <!-- show-signature -->
  <xsl:template name="show-sig">
    <xsl:param name="sig"/>
    <xsl:choose>
      <xsl:when test="$sig/@code = &apos;S&apos;">
        <xsl:text>firmato</xsl:text>
      </xsl:when>
      <xsl:when test="$sig/@code = &apos;I&apos;">
        <xsl:text>inteso</xsl:text>
      </xsl:when>
      <xsl:when test="$sig/@code = &apos;X&apos;">
        <xsl:text>firma necessaria</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!--  show-id -->
  <xsl:template name="show-id">
    <xsl:param name="id" select="."/>
    <xsl:choose>
      <xsl:when test="not($id)">
        <xsl:if test="not(@nullFlavor)">
          <xsl:if test="@extension">
            <xsl:value-of select="@extension"/>
          </xsl:if>
          <xsl:text> </xsl:text>
          <xsl:call-template name="translate-id-type">
            <xsl:with-param name="id-extension" select="@extension"/>
          </xsl:call-template>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="not($id/@nullFlavor)">
          <xsl:if test="$id/@extension">
            <xsl:value-of select="$id/@extension"/>
          </xsl:if>
          <xsl:text> </xsl:text>
          <xsl:call-template name="translate-id-type">
            <xsl:with-param name="id-extension" select="$id/@extension"/>
          </xsl:call-template>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- show-name  -->
  <xsl:template name="show-name">
    <xsl:param name="name"/>
    <xsl:choose>
      <xsl:when test="$name/n1:family">
        <xsl:if test="$name/n1:prefix">
          <xsl:value-of select="$name/n1:prefix"/>
          <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:value-of select="$name/n1:given"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$name/n1:family"/>
        <xsl:if test="$name/n1:suffix">
          <xsl:text>, </xsl:text>
          <xsl:value-of select="$name/n1:suffix"/>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$name"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- show-gender  -->
  <xsl:template name="show-gender">
    <xsl:choose>
      <xsl:when test="@code = &apos;M&apos; or @code = &apos;Male&apos;">
        <xsl:text>Maschio</xsl:text>
      </xsl:when>
      <xsl:when test="@code = &apos;F&apos; or @code = &apos;Female&apos;">
        <xsl:text>Femmina</xsl:text>
      </xsl:when>
      <xsl:when test="@code = &apos;UN&apos; or @code = &apos;Undifferentiated&apos;">
        <xsl:text>Indifferenziato</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- show-race-ethnicity  -->
  <xsl:template name="show-race-ethnicity">
    <xsl:choose>
      <xsl:when test="@displayName">
        <xsl:value-of select="@displayName"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="@code"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- show-contactInfo -->
  <xsl:template name="show-contactInfo">
    <xsl:param name="contact"/>
    <xsl:call-template name="show-address">
      <xsl:with-param name="address" select="$contact/n1:addr"/>
    </xsl:call-template>
    <xsl:call-template name="show-telecom">
      <xsl:with-param name="telecom" select="$contact/n1:telecom"/>
    </xsl:call-template>
  </xsl:template>
  <!-- show-address -->
  <xsl:template name="show-address">
    <xsl:param name="address"/>
    <div class="address-group">
      <xsl:choose>
        <xsl:when test="$address">
          <div class="adress-group-header">
            <xsl:if test="$address/@use">
              <xsl:call-template name="translateTelecomCode">
                <xsl:with-param name="code" select="$address/@use"/>
              </xsl:call-template>
            </xsl:if>
          </div>
          <div class="address-group-content">
            <p class="tight">
              <xsl:for-each select="$address/n1:streetAddressLine">
                <xsl:value-of select="."/>
                <xsl:text> </xsl:text>
              </xsl:for-each>
              <xsl:if test="$address/n1:streetName">
                <xsl:value-of select="$address/n1:streetName"/>
                <xsl:text> </xsl:text>
                <xsl:value-of select="$address/n1:houseNumber"/>
              </xsl:if>
            </p>
            <p class="tight">
              <xsl:if test="string-length($address/n1:city) > 0">
                <xsl:value-of select="$address/n1:city"/>
              </xsl:if>
              <xsl:if test="string-length($address/n1:state) > 0">
                <xsl:text>,&#160;</xsl:text>
                <xsl:value-of select="$address/n1:state"/>
              </xsl:if>
            </p>
            <p class="tight">
              <xsl:if test="string-length($address/n1:postalCode) > 0">
                <!--<xsl:text>&#160;</xsl:text>-->
                <xsl:value-of select="$address/n1:postalCode"/>
              </xsl:if>
              <xsl:if test="string-length($address/n1:country) > 0">
                <xsl:text>,&#160;</xsl:text>
                <xsl:value-of select="$address/n1:country"/>
              </xsl:if>
            </p>
          </div>

        </xsl:when>
        <xsl:otherwise>
          <div class="address-group-content">
            <!-- TODO: Consider removing this kind of "filling in the blanks" by the rendering -->
            <span class="generated-text">
              <xsl:text>&lt;Nessuna informazione inserita in questo campo&gt;</xsl:text>
            </span>
          </div>
        </xsl:otherwise>
      </xsl:choose>
    </div>
  </xsl:template>
  <!-- show-telecom -->
  <xsl:template name="show-telecom">
    <xsl:param name="telecom"/>
    <div class="address-group">
      <xsl:choose>
        <xsl:when test="$telecom">
          <xsl:variable name="type" select="substring-before($telecom/@value, ':')"/>
          <xsl:variable name="value" select="substring-after($telecom/@value, ':')"/>
          <xsl:if test="$type">
            <div class="address-group-header">
              <xsl:call-template name="translateTelecomCode">
                <xsl:with-param name="code" select="$type"/>
              </xsl:call-template>
            </div>
            <div class="address-group-content">
              <xsl:if test="@use">
                <xsl:text> (</xsl:text>
                <xsl:call-template name="translateTelecomCode">
                  <xsl:with-param name="code" select="@use"/>
                </xsl:call-template>
                <xsl:text>)</xsl:text>
              </xsl:if>
              <xsl:value-of select="$value"/>
            </div>
          </xsl:if>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>Informazioni telefoniche non disponibili</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </div>
  </xsl:template>
  <!-- show-recipientType -->
  <xsl:template name="show-recipientType">
    <xsl:param name="typeCode"/>
    <xsl:choose>
      <xsl:when test="$typeCode = 'PRCP'">Destinatario primario:</xsl:when>
      <xsl:when test="$typeCode = 'TRC'">Destinatario secondario:</xsl:when>
      <xsl:otherwise>Destinatario:</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- Convert Telecom URL to display text -->
  <xsl:template name="translateTelecomCode">
    <xsl:param name="code"/>
    <!--xsl:value-of select="document('voc.xml')/systems/system[@root=$code/@codeSystem]/code[@value=$code/@code]/@displayName"/-->
    <!--xsl:value-of select="document('codes.xml')/*/code[@code=$code]/@display"/-->
    <xsl:choose>
      <!-- lookup table Telecom URI -->
      <xsl:when test="$code = 'tel'">
        <xsl:text>Tel</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'fax'">
        <xsl:text>Fax</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'http'">
        <xsl:text>Web</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'mailto'">
        <xsl:text>Mail</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'H'">
        <xsl:text>Casa</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'url'">
        <xsl:text>URL</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'HV'">
        <xsl:text>Casa vacanze</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'HP'">
        <xsl:text>Indirizzo</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'WP'">
        <xsl:text>Indirizzo Lavoro</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'PUB'">
        <xsl:text>Pub</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'TMP'">
        <xsl:text>Temporaneo</xsl:text>
      </xsl:when>
      <xsl:when test="$code = 'BAD'">
        <xsl:text>Cattivo o vecchio</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>{$code='</xsl:text>
        <xsl:value-of select="$code"/>
        <xsl:text>'?}</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- convert RoleClassAssociative code to display text -->
  <xsl:template name="translateRoleAssoCode">
    <xsl:param name="classCode"/>
    <xsl:param name="code"/>
    <xsl:choose>
      <xsl:when test="$classCode = 'AFFL'">
        <xsl:text>affiliato</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'AGNT'">
        <xsl:text>agente</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'ASSIGNED'">
        <xsl:text>entità assegnata</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'COMPAR'">
        <xsl:text>committenza</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'CON'">
        <xsl:text>contatto</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'ECON'">
        <xsl:text>contatto di emergenza</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'NOK'">
        <xsl:text>parente più prossimo</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'SGNOFF'">
        <xsl:text>autorità di firma</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'GUARD'">
        <xsl:text>custode</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'GUAR'">
        <xsl:text>custode</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'CIT'">
        <xsl:text>cittadino</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'COVPTY'">
        <xsl:text>parte coperto</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'PRS'">
        <xsl:text>relazione personale</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'CAREGIVER'">
        <xsl:text>care giver</xsl:text>
      </xsl:when>
      <xsl:when test="$classCode = 'PROV'">
        <xsl:text>healthcare provider</xsl:text>
      </xsl:when>      
    </xsl:choose>
    <xsl:if test="($code/@code) and ($code/@codeSystem = '2.16.840.1.113883.5.111')">
      <xsl:text> </xsl:text>
      <xsl:choose>
        <xsl:when test="$code/@code = 'FTH'">
          <xsl:text>(Padre)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'MTH'">
          <xsl:text>(Madre)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'NPRN'">
          <xsl:text>(Genitore naturale)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'STPPRN'">
          <xsl:text>(patrigno/matrigna)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'SONC'">
          <xsl:text>(Figlio)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'DAUC'">
          <xsl:text>(Figlia)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'CHILD'">
          <xsl:text>(Bambino)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'EXT'">
          <xsl:text>(Esteso membro della famiglia)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'NBOR'">
          <xsl:text>(Vicino)</xsl:text>
        </xsl:when>
        <xsl:when test="$code/@code = 'SIGOTHR'">
          <xsl:text>(Partner)</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>{$code/@code='</xsl:text>
          <xsl:value-of select="$code/@code"/>
          <xsl:text>'?}</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>
  <!-- show time -->
  <xsl:template name="show-time">
    <xsl:param name="datetime"/>
    <xsl:choose>
      <xsl:when test="not($datetime)">
        <xsl:call-template name="formatTimestampLong">
          <xsl:with-param name="date" select="@value"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="formatTimestampLong">
          <xsl:with-param name="date" select="$datetime/@value"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- paticipant facility and date -->
  <xsl:template name="facilityAndDates">
    <table class="header_table">
      <tbody>
        <!-- facility id -->
        <tr>
          <td class="td_header_role_name">
            <span class="td_label">
              <xsl:text>Facility ID</xsl:text>
            </span>
          </td>
          <td class="td_header_role_value">
            <xsl:choose>
              <xsl:when
                test="
                  count(/n1:ClinicalDocument/n1:participant
                  [@typeCode = 'LOC'][@contextControlCode = 'OP']
                  /n1:associatedEntity[@classCode = 'SDLOC']/n1:id) > 0">
                <!-- change context node -->
                <xsl:for-each
                  select="
                    /n1:ClinicalDocument/n1:participant
                    [@typeCode = 'LOC'][@contextControlCode = 'OP']
                    /n1:associatedEntity[@classCode = 'SDLOC']/n1:id">
                  <xsl:call-template name="show-id"/>
                  <!-- change context node again, for the code -->
                  <xsl:for-each select="../n1:code">
                    <xsl:text> (</xsl:text>
                    <xsl:call-template name="show-code">
                      <xsl:with-param name="code" select="."/>
                    </xsl:call-template>
                    <xsl:text>)</xsl:text>
                  </xsl:for-each>
                </xsl:for-each>
              </xsl:when>
              <xsl:otherwise> Non disponibile </xsl:otherwise>
            </xsl:choose>
          </td>
        </tr>
        <!-- Period reported -->
        <tr>
          <td class="td_header_role_name">
            <span class="td_label">
              <xsl:text>Primo giorno del periodo di riferimento</xsl:text>
            </span>
          </td>
          <td class="td_header_role_value">
            <xsl:call-template name="show-time">
              <xsl:with-param name="datetime"
                select="
                  /n1:ClinicalDocument/n1:documentationOf
                  /n1:serviceEvent/n1:effectiveTime/n1:low"
              />
            </xsl:call-template>
          </td>
        </tr>
        <tr>
          <td class="td_header_role_name">
            <span class="td_label">
              <xsl:text>Ultimo giorno del periodo di riferimento</xsl:text>
            </span>
          </td>
          <td class="td_header_role_value">
            <xsl:call-template name="show-time">
              <xsl:with-param name="datetime"
                select="
                  /n1:ClinicalDocument/n1:documentationOf
                  /n1:serviceEvent/n1:effectiveTime/n1:high"
              />
            </xsl:call-template>
          </td>
        </tr>
      </tbody>
    </table>
  </xsl:template>
  <!-- show assignedEntity -->
  <xsl:template name="show-assignedEntity">
    <xsl:param name="asgnEntity"/>
    <xsl:choose>
      <xsl:when test="$asgnEntity/n1:assignedPerson/n1:name">
        <xsl:call-template name="show-name">
          <xsl:with-param name="name" select="$asgnEntity/n1:assignedPerson/n1:name"/>
        </xsl:call-template>
        <xsl:if test="$asgnEntity/n1:representedOrganization/n1:name">
          <xsl:text> - </xsl:text>
          <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$asgnEntity/n1:representedOrganization">
        <xsl:value-of select="$asgnEntity/n1:representedOrganization/n1:name"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="$asgnEntity/n1:id">
          <xsl:call-template name="show-id"/>
          <xsl:choose>
            <xsl:when test="position() != last()">
              <xsl:text>, </xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <br/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- show relatedEntity -->
  <xsl:template name="show-relatedEntity">
    <xsl:param name="relatedEntity"/>
    <xsl:choose>
      <xsl:when test="$relatedEntity/n1:relatedPerson/n1:name">
        <xsl:call-template name="show-name">
          <xsl:with-param name="name" select="$relatedEntity/n1:relatedPerson/n1:name"/>
        </xsl:call-template>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- show associatedEntity -->
  <xsl:template name="show-associatedEntity">
    <xsl:param name="assoEntity"/>
    <xsl:choose>
      <xsl:when test="$assoEntity/n1:associatedPerson">
        <xsl:for-each select="$assoEntity/n1:associatedPerson/n1:name">
          <xsl:call-template name="show-name">
            <xsl:with-param name="name" select="."/>
          </xsl:call-template>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="$assoEntity/n1:scopingOrganization">
        <xsl:for-each select="$assoEntity/n1:scopingOrganization">
          <xsl:if test="n1:name">
            <xsl:call-template name="show-name">
              <xsl:with-param name="name" select="n1:name"/>
            </xsl:call-template>
            <br/>
          </xsl:if>
          <xsl:if test="n1:standardIndustryClassCode">
            <xsl:value-of select="n1:standardIndustryClassCode/@displayName"/>
            <xsl:text> code:</xsl:text>
            <xsl:value-of select="n1:standardIndustryClassCode/@code"/>
          </xsl:if>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="$assoEntity/n1:code">
        <xsl:call-template name="show-code">
          <xsl:with-param name="code" select="$assoEntity/n1:code"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$assoEntity/n1:id">
        <xsl:value-of select="$assoEntity/n1:id/@extension"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="$assoEntity/n1:id/@root"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- show code
     if originalText present, return it, otherwise, check and return attribute: display name
     -->
  <xsl:template name="show-code">
    <xsl:param name="code"/>
    <xsl:variable name="this-codeSystem">
      <xsl:value-of select="$code/@codeSystem"/>
    </xsl:variable>
    <xsl:variable name="this-code">
      <xsl:value-of select="$code/@code"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$code/n1:originalText">
        <xsl:value-of select="$code/n1:originalText"/>
      </xsl:when>
      <xsl:when test="$code/@displayName">
        <xsl:value-of select="$code/@displayName"/>
      </xsl:when>

      <xsl:otherwise>
        <xsl:value-of select="$this-code"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- show classCode -->
  <xsl:template name="show-actClassCode">
    <xsl:param name="clsCode"/>
    <xsl:choose>
      <xsl:when test="$clsCode = 'ACT'">
        <xsl:text>servizio di assistenza sanitaria</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'ACCM'">
        <xsl:text>struttura ricettiva</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'ACCT'">
        <xsl:text>account</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'ACSN'">
        <xsl:text>accessione</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'ADJUD'">
        <xsl:text>aggiudicazione finanziaria</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'CONS'">
        <xsl:text>consenso</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'CONTREG'">
        <xsl:text>registrazione contenitore</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'CTTEVENT'">
        <xsl:text>clinical trial timepoint event</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'DISPACT'">
        <xsl:text>azione disciplinare</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'ENC'">
        <xsl:text>visita</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'INC'">
        <xsl:text>incidente</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'INFRM'">
        <xsl:text>informare</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'INVE'">
        <xsl:text>elemento fattura</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'LIST'">
        <xsl:text>lista di lavoro</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'MPROT'">
        <xsl:text>programma di monitoraggio</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'PCPR'">
        <xsl:text>servizi di assistenza</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'PROC'">
        <xsl:text>procedura</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'REG'">
        <xsl:text>registrazione</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'REV'">
        <xsl:text>revisione</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'SBADM'">
        <xsl:text>somministrazione della sostanza</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'SPCTRT'">
        <xsl:text>trattamento del campione</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'SUBST'">
        <xsl:text>sostituzione</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'TRNS'">
        <xsl:text>trasporto</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'VERIF'">
        <xsl:text>verifica</xsl:text>
      </xsl:when>
      <xsl:when test="$clsCode = 'XACT'">
        <xsl:text>transazione finanziaria</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- show participationType -->
  <xsl:template name="show-participationType">
    <xsl:param name="ptype"/>
    <xsl:choose>
      <xsl:when test="$ptype = 'PPRF'">
        <xsl:text>esecutore primario</xsl:text>
      </xsl:when>
      <xsl:when test="$ptype = 'PRF'">
        <xsl:text>esecutore</xsl:text>
      </xsl:when>
      <xsl:when test="$ptype = 'VRF'">
        <xsl:text>verificatore</xsl:text>
      </xsl:when>
      <xsl:when test="$ptype = 'SPRF'">
        <xsl:text>esecutore secondario</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- show participationFunction -->
  <xsl:template name="show-participationFunction">
    <xsl:param name="pFunction"/>
    <xsl:choose>
      <!-- From the HL7 v3 ParticipationFunction code system -->
      <xsl:when test="$pFunction = 'ADMPHYS'">
        <xsl:text>(medico di accettazione)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'ANEST'">
        <xsl:text>(anestesista)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'ANRS'">
        <xsl:text>(infermiere anestesia)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'ATTPHYS'">
        <xsl:text>(medico curante)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'DISPHYS'">
        <xsl:text>(medico dimittente)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'FASST'">
        <xsl:text>(primo assistente chirurgo)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'MDWF'">
        <xsl:text>(ostetrica)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'NASST'">
        <xsl:text>(assistente infermiera)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'PCP'">
        <xsl:text>(medico di base)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'PRISURG'">
        <xsl:text>(chirurgo primario)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'RNDPHYS'">
        <xsl:text>(rounding physician)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'SASST'">
        <xsl:text>(second assistant surgeon)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'SNRS'">
        <xsl:text>(scrub nurse)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'TASST'">
        <xsl:text>(terzo assistente)</xsl:text>
      </xsl:when>
      <!-- From the HL7 v2 Provider Role code system (2.16.840.1.113883.12.443) which is used by HITSP -->
      <xsl:when test="$pFunction = 'CP'">
        <xsl:text>(fornitore di consulenza)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'PP'">
        <xsl:text>(fornitore di cure primarie)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'RP'">
        <xsl:text>(fornitore di riferimento)</xsl:text>
      </xsl:when>
      <xsl:when test="$pFunction = 'MP'">
        <xsl:text>(operatore del paese medico)</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>
  <!-- convert to lower case -->
  <xsl:template name="caseDown">
    <xsl:param name="data"/>
    <xsl:if test="$data">
      <xsl:value-of
        select="translate($data, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
    </xsl:if>
  </xsl:template>
  <!-- convert to upper case -->
  <xsl:template name="caseUp">
    <xsl:param name="data"/>
    <xsl:if test="$data">
      <xsl:value-of
        select="translate($data, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
    </xsl:if>
  </xsl:template>
  <!-- convert first character to upper case -->
  <xsl:template name="firstCharCaseUp">
    <xsl:param name="data"/>
    <xsl:if test="$data">
      <xsl:call-template name="caseUp">
        <xsl:with-param name="data" select="substring($data, 1, 1)"/>
      </xsl:call-template>
      <xsl:value-of select="substring($data, 2)"/>
    </xsl:if>
  </xsl:template>
  <!-- show-noneFlavor -->
  <xsl:template name="show-noneFlavor">
    <xsl:param name="nf"/>
    <xsl:choose>
      <xsl:when test="$nf = 'NI'">
        <xsl:text>nessuna informazione</xsl:text>
      </xsl:when>
      <xsl:when test="$nf = 'INV'">
        <xsl:text>non valido</xsl:text>
      </xsl:when>
      <xsl:when test="$nf = 'MSK'">
        <xsl:text>mascherato</xsl:text>
      </xsl:when>
      <xsl:when test="$nf = 'NA'">
        <xsl:text>non applicabile</xsl:text>
      </xsl:when>
      <xsl:when test="$nf = 'UNK'">
        <xsl:text>sconosciuto</xsl:text>
      </xsl:when>
      <xsl:when test="$nf = 'OTH'">
        <xsl:text>altro</xsl:text>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <!-- convert common OIDs for Identifiers -->
  <xsl:template name="translate-id-type">
    <xsl:param name="id-extension"/>
	<xsl:choose>
			<xsl:when test="$id-extension='160106'">
				<xsl:text>ASL BRINDISI</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160112'">
				<xsl:text>ASL TARANTO</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160113'">
				<xsl:text>ASL BAT</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160114'">
				<xsl:text>ASL BARI</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160115'">
				<xsl:text>ASL FOGGIA</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160116'">
				<xsl:text>ASL LECCE</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160907'">
				<xsl:text>AO POLICLINICO DI BARI</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160910'">
				<xsl:text>AO OSPEDALI RIUNITI DI FOGGIA</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160901'">
				<xsl:text>IRCCS ONCOLOGICO - BARI</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160902'">
				<xsl:text>IRCCS DE BELLIS - CASTELLANA GROTTE</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160906'">
				<xsl:text>IRCCS S. MAUGERI - CASSANO DELLE MURGE</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160078'">
				<xsl:text>EE MIULLI - ACQUAVIVA DELLE FONTI</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160905'">
				<xsl:text>EE CASA SOLLIEVO - SAN GIOVANNI ROTONDO</xsl:text>
			</xsl:when>
			<xsl:when test="$id-extension='160080'">
				<xsl:text>EE CARDINALE PANICO - TRICASE</xsl:text>
			</xsl:when>
		</xsl:choose>
  </xsl:template>
  <xsl:template name="lantana-css">
    <style>
      .cda-render{ font-family:CenturyGothic, sans-serif; }
      .cda-render h1.cda-title{ color:#b3623d; font-size:1.5em; font-weight:bold; text-align:center; text-transform: uppercase; padding-top:110px; }
	  #main.cda-render{  }
      .cda-render .patient-header { min-height: 50px; padding: 15px 15px; font-size: 1.5em; }
	  .cda-render .toc { margin-top:3em; padding: 10px 15px; }
	  .cda-render .toc-box { padding-top: 110px; }
      .cda-render .patient-name { color:#336b7a; font-size:1.25em; font-weight:bold; }
      .cda-render .section-title { color:#336b7a; font-size:1.09em; font-weight:bold; text-transform: uppercase; padding-top: 25px;}
      .cda-render .attribute-title {color:#000000;font-weight:bold;font-size:1.04em;}
      .cda-render .header{border-bottom-width:0.1em;border-bottom-style:solid;border-bottom-color:#1B6373;padding-bottom:0.5em;}
      .cda-render .header-group-content{margin-left:1em;padding-left:0.5em;border-left-width:0.15em;border-left-style:solid;border-left-color:#478B95;}
	  .cda-render .tight{margin:0;}
	  .cda-render .generated-text{white-space:no-wrap;margin:0em;color:#B0592C;font-style:italic;}
      .cda-render .bottom{border-top-width:0.2em;border-top-color:#B0592C;border-top-style:solid;}      
      .cda-render .lantana-toc {text-transform: uppercase; }
      .cda-render .bold {font-weight: bold;}
      .cda-render .active {border-right-color: #336b7a;border-right-style: solid;border-left-color: #336b7a;border-left-style: solid;background-color:#eee;}
      #navbar-list-cda {overflow: auto;}
	  #navbar-cda{ max-width: 350px; padding-top: 130px;}
	  #navbar-cda ul#navbar-list-cda ul { margin-left: 10px; }
	  #navbar-cda ul#navbar-list-cda li a { padding: 5px; }
	  .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
		  border-top: 1px solid #ddd;line-height: 1.8em;padding: 5px 8px;vertical-align: top;}
		:target:before {content:" ";display:block;height:130px; margin-top:0; }
    </style>
  </xsl:template>
  <xsl:template name="bootstrap-css">
          <style type="text/css">
            /*!
            * Bootstrap v3.3.5 (http://getbootstrap.com)
            * Copyright 2011-2015 Twitter, Inc.
            * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
            *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.33px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:3;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}
          </style>
  </xsl:template>
  
  
  
  
    <!--
	<xsl:template name="strip-tags">
		<xsl:param name="text"/>
		<xsl:choose>
			<xsl:when test="contains($text, '&lt;')">
				<xsl:value-of select="substring-before($text, '&lt;')"/>
				<xsl:call-template name="strip-tags">
						<xsl:with-param name="text" select="substring-after($text, '&gt;')"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	-->
  
	<!-- strip del tag list -->
	<xsl:template match="n1:component/n1:structuredBody/n1:component/n1:section/n1:component/n1:section/n1:text/n1:list">
		<!--<div style="background:red;"><xsl:copy-of select="."/></div>-->
		<xsl:apply-templates/>
	</xsl:template>




</xsl:stylesheet>