<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2004/07/xpath-functions" xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes" xmlns:n1="http://www.tdwg.org/schemas/abcd/1.2" exclude-result-prefixes="xsl xs fn xdt n1">
	<xsl:output version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" media-type="text/html"/>
	<xsl:include href="ABCD1.2_CommonTemplates.xslt"/>
	<xsl:template match="/">
		<!--      **************************************UNIT*********************************************  -->
		<xsl:for-each select="n1:DataSets/n1:DataSet/n1:Units/n1:Unit">
			<div id="Unit">
				<!-- ********************************* HEADER ************************************** 	-->
							<h2>
								<!-- ***********************************************************************+NAME****************************************************** -->
								<xsl:for-each select="n1:Identifications/n1:Identification">
									<!--General rule for names -->
									<!-- Avoid execution if there are no Identifications-->
									<!--Differenciate if there is only one identification o more -->
									<xsl:choose>
										<xsl:when test="count(../n1:Identification) = 1">
											<!--Only one identification, is shown as non preferred -->
											<span class="preferedbig">
												<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
											</span>
										</xsl:when>
										<!-- more than 1 identifications -->
										<xsl:otherwise>
											<!--Check if there is a preferredflag -->
											<xsl:choose>
												<xsl:when test="not(@PreferredIdentificationFlag)">
													<!-- Identification without preferred flag -->
													<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/> |
															</xsl:when>
												<xsl:otherwise>
													<xsl:choose>
														<xsl:when test="@PreferredIdentificationFlag= '1' or @PreferredIdentificationFlag='true'">
															<!--Multiple identifications, preferred one -->
															<span class="preferedbig">
																<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
															</span>
														</xsl:when>
														<xsl:otherwise>
															<!--Multiple identifications, non preferred one -->
														</xsl:otherwise>
													</xsl:choose>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:for-each>
								<!-- ***********************************************************************+NAME****************************************************** -->
							</h2>
							
							<table>
							  <tr valign="top">								
								<td width="90%">		
									<p>
									<!-- ** GUID ** -->
									<a name="{normalize-space(../../n1:OriginalSource/n1:SourceInstitutionCode)}-{normalize-space(../../n1:OriginalSource/n1:SourceName)}-{normalize-space(n1:UnitID)}" class="linktarget">
										<strong>ID: </strong><xsl:value-of select="n1:UnitID"/>
									</a>
									<br/><strong>Institution: </strong><xsl:value-of select="../../n1:OriginalSource/n1:SourceInstitutionCode"/>
									<br/><strong>Source: </strong><xsl:value-of select="../../n1:OriginalSource/n1:SourceName"/>
									<xsl:if test="n1:RecordBasis">
										<br/>
										<strong>Record basis: </strong>
										<xsl:value-of select="n1:RecordBasis"/>
									</xsl:if>
									<br/><strong>Last update: </strong><xsl:value-of select="../../n1:OriginalSource/n1:SourceLastUpdatedDate"/>

									<xsl:choose>
										<xsl:when test="../../n1:OriginalSource/n1:SourceWebAddress">
											<br/>
										</xsl:when>
										<xsl:otherwise>
											<xsl:if test="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Supplier/n1:EmailAddresses/n1:EmailAddress">
												<br/>
											</xsl:if>									
										</xsl:otherwise>
									</xsl:choose>
									
									<xsl:if test="../../n1:OriginalSource/n1:SourceWebAddress">
										<a><xsl:attribute name="href"><xsl:value-of select="../../n1:OriginalSource/n1:SourceWebAddress"/></xsl:attribute>
										<xsl:value-of select="../../n1:OriginalSource/n1:SourceWebAddress"/></a> |
									</xsl:if>
									<xsl:if test="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Supplier/n1:EmailAddresses/n1:EmailAddress">
										<a><xsl:attribute name="href"><xsl:text disable-output-escaping="yes">mailto:</xsl:text><xsl:value-of select="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Supplier/n1:EmailAddresses/n1:EmailAddress"/></xsl:attribute>EMAIL</a>
									</xsl:if>
									</p>
								</td>
								<td valign="top">
									<xsl:if test="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Statements/n1:LogoURL">
											<img border="0" src="{../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Statements/n1:LogoURL}" align="right" height="45"/>
									</xsl:if>
								</td>
							  </tr>
							<xsl:if test="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Description">
							  <tr>								
								<td width="100%" colspan="2">		
									<p><strong>Description: </strong>
										<xsl:value-of select="../../n1:DatasetDerivations/n1:DatasetDerivation/n1:Description"/>
									</p>
								</td>
							  </tr>
							</xsl:if>
							</table>

				<!-- *********************************/HEADER ************************************** 	-->
				<!-- *********************************IDENTIFICATIONS ************************************** 	-->
				<h3 class="background">Identification(s): </h3>
				<table  border="0">
					<tr>
						<th>Name</th>
						<xsl:if test="n1:Identifications/n1:Identification/n1:TaxonIdentified/n1:HigherTaxa/n1:HigherTaxon != ''">
							<th>Taxonomy</th>
						</xsl:if>
						<xsl:if test="string(n1:Identifications/n1:Identification/n1:IdentificationReference)">
							<th>Reference</th>
						</xsl:if>
						<xsl:if test="string(n1:IdentificationNotes)">
							<th>Notes</th>
						</xsl:if>
						<xsl:if test="string(n1:Identifications/n1:Identification/n1:TaxonIdentified/n1:InformalNameString)">
							<th>Common name(s)</th>
						</xsl:if>
					</tr>
					<xsl:for-each select="n1:Identifications/n1:Identification">
						<xsl:sort select="@PreferredIdentificationFlag" data-type="text" order="descending"/>
						<!-- Change the color of the background depending if it is a PREFERRED identification or not -->
						<tr>
							<td>
								<!-- ***********************************************************************+NAME****************************************************** -->
								<!--General rule for names -->
								<!-- Avoid execution if there are no Identifications-->
								<!--Differenciate if there is only one identification o more -->
								<xsl:choose>
									<xsl:when test="count(../n1:Identification) = 1">
										<!--Only one identification, is shown as non preferred -->
										<span class="prefered">
											<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
										</span>
										<xsl:if test="n1:TaxonIdentified/n1:AuthorString">
											<br/><strong>Author(s): </strong> 
											<xsl:value-of select="n1:TaxonIdentified/n1:AuthorString"/>
										</xsl:if>
									</xsl:when>
									<!-- more than 1 identifications -->
									<xsl:otherwise>
										<!--Check if there is a preferredflag -->
										<xsl:choose>
											<xsl:when test="not(@PreferredIdentificationFlag)">
												<!-- Identification without preferred flag -->
												<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
												<xsl:if test="n1:TaxonIdentified/n1:AuthorString">
													<br/><strong>Author(s): </strong> 
													<xsl:value-of select="n1:TaxonIdentified/n1:AuthorString"/>
												</xsl:if>												
											</xsl:when>
											<xsl:otherwise>
												<xsl:choose>
													<xsl:when test="@PreferredIdentificationFlag= '1' or @PreferredIdentificationFlag='true'">
														<!--Multiple identifications, preferred one -->
														<span class="prefered">
															<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
														</span>
														<xsl:if test="n1:TaxonIdentified/n1:AuthorString">
															<br/><strong>Author(s): </strong> 
															<xsl:value-of select="n1:TaxonIdentified/n1:AuthorString"/>
														</xsl:if>																									</xsl:when>
													<xsl:otherwise>
														<!--Multiple identifications, non preferred one -->
														<xsl:value-of select="n1:TaxonIdentified/n1:NameAuthorYearString"/>
														<xsl:if test="n1:TaxonIdentified/n1:AuthorString">
															<br/><strong>Author(s): </strong> 
															<xsl:value-of select="n1:TaxonIdentified/n1:AuthorString"/>
														</xsl:if>																								</xsl:otherwise>
												</xsl:choose>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:otherwise>
								</xsl:choose>
								<!-- 
*****************************************************************/+NAME****************************************************** -->
								<xsl:if test="n1:IdentificationDate">
									<br/>
									<strong>Date: </strong>
									<xsl:value-of select="n1:IdentificationDate"/>
								</xsl:if>
								<xsl:if test="n1:Identifier">
									<br/>
									<strong>Identifier: </strong>
									<xsl:value-of select="n1:Identifier"/>
								</xsl:if>
							</td>
							<xsl:if test="n1:TaxonIdentified/n1:HigherTaxa/n1:HigherTaxon != ''">
								<td>
									<xsl:for-each select="n1:TaxonIdentified/n1:HigherTaxa/n1:HigherTaxon">
										<xsl:if test="@TaxonRank">
											<strong>
												<xsl:value-of select="@TaxonRank"/>: </strong>
										</xsl:if>
										<xsl:value-of select="."/>
										<xsl:text disable-output-escaping="yes"> </xsl:text>
									</xsl:for-each>
								</td>
							</xsl:if>
							<xsl:if test="string(n1:IdentificationReference)">
								<td>
									<xsl:value-of select="n1:IdentificationReference/n1:ReferenceCitation"/>
									<br/>
									<strong>Details: </strong>
									<xsl:value-of select="n1:IdentificationReference/n1:ReferenceDetail"/>
								</td>
							</xsl:if>
							<xsl:if test="string(n1:IdentificationNotes)">
								<td>
									<xsl:value-of select="n1:IdentificationNotes"/>
								</td>
							</xsl:if>
							<xsl:if test="string(n1:TaxonIdentified/n1:InformalNameString)">
								<td>
									<xsl:value-of select="n1:TaxonIdentified/n1:InformalNameString"/> 
									<xsl:if test="n1:TaxonIdentified/n1:InformalNameString/@Language">
										(<xsl:value-of select="n1:TaxonIdentified/n1:InformalNameString/@Language"/>)
									</xsl:if>
											</td>
							</xsl:if>
						</tr>
					</xsl:for-each>
				</table>
				<!-- ********************************* /IDENTIFICATIONS ************************************** 	-->
				<!-- *********************************GATHERING ************************************** 	-->
				<xsl:if test="n1:Gathering">
					<h3 class="background">Collection Event:</h3>
					<table >
						<tr>
							<xsl:if test="n1:Gathering/n1:GatheringSite">
								<th>Locality:</th>
							</xsl:if>
							<xsl:if test="n1:Gathering/n1:GatheringAgents">
								<th>Collector:</th>
							</xsl:if>
							<th>Further gathering information:</th>
						</tr>
						<tr valign="top">
							<td>
								<xsl:if test="n1:Gathering/n1:GatheringSite/n1:Country">
									<strong>Country: </strong>
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:Country/n1:CountryName"/>,  <xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:Country/n1:ISO2Letter"/>
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:Country/n1:ISO3Letter"/>
									<br/>
								</xsl:if>
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:ContinentOrOcean)">
									<strong>Continent or ocean: </strong>
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:ContinentOrOcean"/>
									<br/>
								</xsl:if>
								<xsl:if test="n1:Gathering/n1:GatheringSite/n1:NamedAreas">
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:NamedAreas/n1:NamedArea">
										<strong>
											<xsl:value-of select="n1:NamedAreaClass"/>Details: </strong>
										<xsl:value-of select="n1:NamedAreaName"/>
										<br/>
									</xsl:for-each>
								</xsl:if>
								<xsl:if test="n1:Gathering/n1:GatheringSite/n1:LocalityText">
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:LocalityText"/>
									<br/>
								</xsl:if>
								<xsl:if test="n1:Gathering/n1:GatheringSite/n1:Notes">
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:Notes"/>
								</xsl:if>
								<xsl:if test="n1:Gathering/n1:GatheringSite/n1:SiteCoordinateSets">
									<br/>
									<form action="http://linuxgurrl.agr.gc.ca/mapdata/itis/itisrosa.php" method="POST" target="_blank">
										<xsl:attribute name="name">GeneralMap</xsl:attribute>
										<input>
											<xsl:attribute name="value">%3C%3Fxml+version%3D%271.0%27+encoding%3D%27iso-8859-1%27%3F%3E%3Cresponse%3E%3Cheader%3E%3Cauthor%3E%3C%2Fauthor%3E%3Cboundingbox%3E-180%2C-90%2C180%2C90%2CWorld%3C%2Fboundingbox%3E%3Cdescription%3EThis+Generic+Point+Mapper+is+a+service+provided+by+the+Canadian+Biological+Information+Facility%3C%2Fdescription%3E%3Cifx%3E%3C%2Fifx%3E%3Clanguage%3Een%3C%2Flanguage%3E%3Cprojection%3Elatlong%3C%2Fprojection%3E%3Crecordcount%3E%3C%2Frecordcount%3E%3Ctimestamp%3E2004-11-30+11%3A10%3A58.043%3C%2Ftimestamp%3E%3Ctitle%3ESimple+access+to+ABCD+providers+-+Point+Location+Data%3C%2Ftitle%3E%3Curl%3Ehttp%3A%2F%2Fwww.cbif.gc.ca%2Fmc%2Findex_e.php%3C%2Furl%3E%3C%2Fheader%3E%3Crecords
													<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:SiteCoordinateSets/n1:SiteCoordinates">
														%3E%3Crecord
															<xsl:for-each select="n1:CoordinatesLatLong"><xsl:for-each select="n1:LatitudeDecimal">
																	%3E%3Clatitude%3E<xsl:apply-templates/>%3C%2Flatitude
																</xsl:for-each><xsl:for-each select="n1:LongitudeDecimal">
																	%3E%3Clongitude%3E<xsl:apply-templates/>%3C%2Flongitude
																</xsl:for-each></xsl:for-each>
															%3E%3Crecordurl%3E%3C%2Frecordurl
															%3E%3C%2Frecord
													</xsl:for-each>
												%3E%3C%2Frecords%3E%3C%2Fresponse%3E
											</xsl:attribute>
											<xsl:attribute name="type">hidden</xsl:attribute>
											<xsl:attribute name="name">xml</xsl:attribute>
										</input>
												Coordinates: <xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:SiteCoordinateSets/n1:SiteCoordinates/n1:CoordinatesLatLong/n1:LatitudeDecimal"/> | <xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:SiteCoordinateSets/n1:SiteCoordinates/n1:CoordinatesLatLong/n1:LongitudeDecimal"/>
										<a href="Javascript:document.GeneralMap.submit()"> Generate map</a>
									</form>
								</xsl:if>
								<!-- /For to create a map-->
							</td>
							<xsl:if test="n1:Gathering/n1:GatheringAgents">
								<td>
									<xsl:for-each select="n1:Gathering/n1:GatheringAgents/n1:GatheringAgent">
										<xsl:apply-templates/>
										<br/>
									</xsl:for-each>
								</td>
							</xsl:if>
							<td>
								<xsl:if test="string(n1:Gathering/n1:GatheringDateTime)">
									<strong>Date: </strong>
									<xsl:value-of select="n1:Gathering/n1:GatheringDateTime"/>
									<br/>
								</xsl:if>
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:Altitude/n1:MeasurementAtomized)">
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:Altitude/n1:MeasurementAtomized">
										<strong>Altitude: </strong>
										<xsl:value-of select="n1:MeasurementLowerValue"/>
										<xsl:value-of select="n1:MeasurementScale"/>
										<xsl:if test="string(n1:MeasurementUpperValue)">- 
											<xsl:value-of select="n1:MeasurementUpperValue"/>
										</xsl:if>
										<xsl:value-of select="n1:MeasurementScale"/>
										<br/>
									</xsl:for-each>
								</xsl:if>
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:Depth/n1:MeasurementAtomized)">
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:Depth/n1:MeasurementAtomized">
										<strong>Depth: </strong>
										<xsl:value-of select="n1:MeasurementLowerValue"/>
										<xsl:value-of select="n1:MeasurementScale"/>
										<xsl:if test="string(n1:MeasurementUpperValue)">- 
											<xsl:value-of select="n1:MeasurementUpperValue"/>
										</xsl:if>
										<xsl:value-of select="n1:MeasurementScale"/>
										<br/>
									</xsl:for-each>
								</xsl:if>
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:Hight/n1:MeasurementAtomized)">
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:Hight/n1:MeasurementAtomized">
										<strong>Level above ground: </strong>
										<xsl:value-of select="n1:MeasurementLowerValue"/>
										<xsl:value-of select="n1:MeasurementScale"/>
										<xsl:if test="string(n1:MeasurementUpperValue)">- 
											<xsl:value-of select="n1:MeasurementUpperValue"/>
										</xsl:if>
										<xsl:value-of select="n1:MeasurementScale"/>
										<br/>
									</xsl:for-each>
								</xsl:if>		
								
								<!-- Aspect -->						
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:Aspect)">
									<strong>Aspect </strong>
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:Aspect">
										<xsl:if test="string(n1:Ordination)">
											<strong>Ordination: </strong>
											<xsl:value-of select="n1:Ordination"/>
											<xsl:text> </xsl:text>
										</xsl:if>
										<xsl:if test="string(n1:CompassBearing)">
											<strong>Compass bearing: </strong>
											<xsl:value-of select="n1:CompassBearing"/>
											<xsl:text> </xsl:text>
										</xsl:if>
										<xsl:if test="string(n1:Accuracy)">
											<strong>Accuracy: </strong>
											<xsl:value-of select="n1:Accuracy"/>
											<xsl:text> </xsl:text>										
										</xsl:if>
									<!-- freetext description (AspectText) should probably rather be 
										included as an alternative to the above!
									-->		
										<xsl:if test="string(n1:AspectText)">
											<strong>Description: </strong>
											<xsl:value-of select="n1:AspectText"/>
										</xsl:if>
									</xsl:for-each>	
									<br/>
								</xsl:if>
								<!-- /Aspect -->
								
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:Slope/n1:MeasurementAtomized)">
									<xsl:for-each select="n1:Gathering/n1:GatheringSite/n1:Slope/n1:MeasurementAtomized">
										<strong>Slope: </strong>
										<xsl:value-of select="n1:MeasurementLowerValue"/>
										<xsl:value-of select="n1:MeasurementScale"/>
										<xsl:if test="string(n1:MeasurementUpperValue)">- 
											<xsl:value-of select="n1:MeasurementUpperValue"/>
										</xsl:if>
										<xsl:value-of select="n1:MeasurementScale"/>
										<br/>
									</xsl:for-each>
								</xsl:if>									
								
								<xsl:if test="string(n1:Gathering/n1:GatheringSite/n1:BiotopeData)">
									<strong>Biotope:</strong>
									<xsl:value-of select="n1:Gathering/n1:GatheringSite/n1:BiotopeData"/>
									<br/>
								</xsl:if>
								<xsl:if test="string(n1:Gathering/n1:Project/n1:ProjectTitle)">
									<strong>Project: </strong>
									<xsl:value-of select="n1:Gathering/n1:ProjectTitle"/>
								</xsl:if>
							</td>
						</tr>
					</table>
				</xsl:if>
				<!-- ********************************* /GATHERING ************************************** 	-->
				<!-- *********************************DIGITAL IMAGES ************************************** 	-->
				<xsl:if test="n1:UnitDigitalImages/n1:UnitDigitalImage/n1:ImageURI">
					<xsl:for-each select="n1:UnitDigitalImages">
						<h3 class="background">  Digital Images:</h3>
						<table border="1" bordercolor="#e4e4e4" cellpadding="5" cellspacing="5" >
							<tbody>
								<tr valign="top" >
									<td>
										<ul>
											<xsl:for-each select="n1:UnitDigitalImage/n1:ImageURI">
												<li>
													<a target="_blank">
														<xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
														<xsl:apply-templates/>
													</a>
												</li>
											</xsl:for-each>
										</ul>
									</td>
									<td>
										<xsl:for-each select="n1:UnitDigitalImage/n1:ImageIPR">
											<strong>Image IPR: </strong>
											<xsl:apply-templates/>
										</xsl:for-each>
										<xsl:for-each select="n1:UnitDigitalImage/n1:Comment">
											<strong>Comment: </strong>
											<xsl:apply-templates/>
										</xsl:for-each>
									</td>
								</tr>
							</tbody>
						</table>
					</xsl:for-each>
				</xsl:if>
				<!-- ********************************* /DIGITAL IMAGES ************************************** 	-->
				<!-- *********************************FACTS ************************************** 	-->
				<xsl:if test="n1:UnitFacts/n1:FactText">
					<xsl:for-each select="n1:UnitFacts">
						<h3 class="background">Facts:</h3>
						<table>
							<tr>
								<xsl:if test="n1:UnitFact/n1:FactType">
									<th>Type</th>
								</xsl:if>
								<xsl:if test="n1:UnitFact/n1:FactText">
									<th>Text</th>
								</xsl:if>
								<xsl:if test="n1:UnitFact/n1:DateEntered">
									<th>Date</th>
								</xsl:if>
								<xsl:if test="n1:UnitFact/n1:AddedBy">
									<th>Added by</th>
								</xsl:if>
								<xsl:if test="n1:UnitFact/n1:Reference">
									<th>Reference</th>
								</xsl:if>
							</tr>
							<xsl:for-each select="n1:UnitFact">
								<tr>
									<xsl:if test="n1:FactType">
										<td>
											<xsl:for-each select="n1:FactType">
												<xsl:apply-templates/>
											</xsl:for-each>
										</td>
									</xsl:if>
									<xsl:if test="n1:FactText">
										<td>
											<xsl:for-each select="n1:FactText">
												<xsl:apply-templates/>
											</xsl:for-each>
										</td>
									</xsl:if>
									<xsl:if test="n1:DateEntered">
										<td>
											<xsl:for-each select="n1:DateEntered">
												<xsl:apply-templates/>
											</xsl:for-each>
										</td>
									</xsl:if>
									<xsl:if test="n1:AddedBy">
										<td>
											<xsl:for-each select="n1:AddedBy">
												<xsl:apply-templates/>
											</xsl:for-each>
										</td>
									</xsl:if>
									<xsl:if test="n1:Reference">
										<td>
											<xsl:for-each select="n1:Reference">
												<xsl:apply-templates/>
											</xsl:for-each>
										</td>
									</xsl:if>
								</tr>
							</xsl:for-each>
						</table>
					</xsl:for-each>
				</xsl:if>
				<!-- ********************************* /FACTS ************************************** 	-->
				<!-- ******************************** UNIT MEASUREMENTS ********************  -->
				<xsl:for-each select="n1:UnitMeasurements">
					<xsl:for-each select="n1:UnitMeasurement">
						<table>
							<tr>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementAppliesTo">
									<th>Measurement applies to</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementMethod">
									<th>Method</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementDuration">
									<th>Duration</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementAccuracy">
									<th>Accuracy</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:ParameterMeasured">
									<th>Parameter</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementScale">
									<th>Scale</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementLowerValue">
									<th>Lower value</th>
								</xsl:if>
								<xsl:if test="n1:UnitMeasurements/n1:UnitMeasurement/n1:MeasurementUpperValue">
									<th>Upper value</th>
								</xsl:if>
							</tr>
							<xsl:for-each select="n1:MeasurementAtomized">
								<tr>
									<xsl:for-each select="n1:MeasurementAppliesTo">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementMethod">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementDuration">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementAccuracy">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:ParameterMeasured">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementScale">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementLowerValue">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
									<xsl:for-each select="n1:MeasurementUpperValue">
										<td>
											<xsl:apply-templates/>
										</td>
									</xsl:for-each>
								</tr>
							</xsl:for-each>
						</table>
					</xsl:for-each>
				</xsl:for-each>
				<!-- ******************************** /UNIT MEASUREMENTS ********************  -->
				<!--********************************** UNIT COLLECTION DOMAIN/ BOTANICAL GARDEN ***************************** -->
				<xsl:for-each select="n1:UnitCollectionDomain">
					<h3 class="background">Botanischer Garten:</h3>
					<table>
						<tr>
							<xsl:if test="n1:BotanicalGardenUnit/n1:AccessionSpecimenNumbers">
								<th>Number of accessions</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:AccessionStatus">
								<th>Accession status</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:AccessionMaterialType">
								<th>Material type</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:Hardiness">
								<th>Hardiness</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:ProvenanceCategory">
								<th>Provenance category</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:PropagationHistoryCode">
								<th>Propagation history code</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:AccessionLineage">
								<th>Lineage</th>
							</xsl:if>
							<xsl:if test="n1:BotanicalGardenUnit/n1:DonorCategory">
								<th>Donor category</th>
							</xsl:if>
						</tr>
						<xsl:for-each select="n1:BotanicalGardenUnit">
							<tr>
								<xsl:for-each select="n1:AccessionSpecimenNumbers">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:AccessionStatus">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:AccessionMaterialType">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:Hardiness">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:ProvenanceCategory">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:PropagationHistoryCode">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:AccessionLineage">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
								<xsl:for-each select="n1:DonorCategory">
									<td>
										<xsl:apply-templates/>
									</td>
								</xsl:for-each>
							</tr>
						</xsl:for-each>
					</table>
				</xsl:for-each>
				<!--********************************** /UNIT COLLECTION DOMAIN/ BOTANICAL GARDEN ***************************** -->
				<!--********************************** UNIT STATE DOMAIN/ OBSERVATION UNIT *************************************** -->
				<!-- This section is still incomplete! -->
				<xsl:for-each select="n1:UnitStateDomain">
					<h3 class="background">Beobachtungsdaten:</h3>
					<table cellpadding="5" cellspacing="5" >
						<tbody>
							<tr  valign="top">
								<td>
									<xsl:for-each select="n1:ObservationUnit/n1:ObservationMethod/n1:Term">
										<xsl:if test="../n1:Domain">
											<strong>Observation method: </strong>
											<xsl:value-of select="../n1:Domain"/>: 
										</xsl:if>
										<xsl:value-of select="."/>
										<xsl:text disable-output-escaping="yes"> </xsl:text>
										<br/>
									</xsl:for-each>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:for-each>
				<!--********************************** /UNIT STATE DOMAIN/ OBSERVATION UNIT *************************************** -->
				<!-- *********************************OTHER DATA ************************************** 	-->
				<xsl:if test="n1:LastEditor or n1:DateLastEdited or n1:CollectorsFieldNumber or n1:UnitStateDomain/n1:SpecimenUnit/n1:NomenclaturalTypeDesignations/n1:NomenclaturalTypeDesignation/n1:TypeStatus">
					<h3 class="background">Andere Daten:</h3>
					<table>
						<tbody>
							<tr  valign="top">
								<td>
									<!-- Last editor -->
									<xsl:for-each select="n1:LastEditor">
										<strong>Last editor:</strong>
										<xsl:apply-templates/>
									</xsl:for-each>
									<!-- Last editor -->
									<xsl:for-each select="n1:DateLastEdited">
										<strong>Date last edited:</strong>
										<xsl:apply-templates/>
									</xsl:for-each>
									<xsl:for-each select="n1:CollectorsFieldNumber">
										<strong>Collectors field number:</strong>
										<xsl:apply-templates/>
									</xsl:for-each>
									<xsl:for-each select="n1:UnitStateDomain/n1:SpecimenUnit/n1:NomenclaturalTypeDesignations/n1:NomenclaturalTypeDesignation/n1:TypeStatus">
										<br/>
										<strong>Type status: </strong>
										<xsl:apply-templates/>
									</xsl:for-each>
									<xsl:for-each select="n1:UnitStateDomain/n1:SpecimenUnit/n1:NomenclaturalTypeDesignations/n1:NomenclaturalTypeDesignation/n1:TypifiedName">
										<br/>
										<strong>Typified name: </strong>
										<xsl:apply-templates/>
									</xsl:for-each>
									<xsl:for-each select="n1:UnitStateDomain/n1:SpecimenUnit/n1:NomenclaturalTypeDesignations/n1:NomenclaturalTypeDesignation/n1:NomenclaturalReference">
										<br/>
										<strong>Nomenclatural reference: </strong>
										<xsl:apply-templates/>
									</xsl:for-each>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:if>
				<!-- ********************************* /OTHER DATA ************************************** 	-->
				<!-- ********************************* IPR Specific for the Unit ************************************** 	-->
				<xsl:for-each select="n1:RecordRights">
					<h3 class="background">Specific unit rights:</h3>
					<table>
						<tbody>
							<tr  valign="top">
								<td>
									<xsl:apply-templates/>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:for-each>
				<!-- ********************************* /IPR Specific for the Unit************************************** 	-->
				<!-- ********************************* UnitStatements ************************************** 	-->
				<xsl:for-each select="n1:UnitStatements">
					<h3 class="background">Specific unit statements:</h3>
					<table>
						<tbody>
							<tr  valign="top">
								<td>
									<xsl:apply-templates/>
								</td>
							</tr>
						</tbody>
					</table>
				</xsl:for-each>
				<!-- ********************************* /UnitStatements************************************** 	-->
				<!-- *********************************NOTES ************************************** 	-->
				<xsl:if test="string(n1:UnitDescription)">
					<xsl:for-each select="n1:UnitDescription">
						<h3 class="background">General notes:</h3>
						<table>
							<tbody>
								<tr  valign="top">
									<td>
										<xsl:apply-templates/>
									</td>
								</tr>
							</tbody>
						</table>
					</xsl:for-each>
				</xsl:if>
				<!-- ********************************* /NOTES ************************************** 	-->
				<p/>
			</div>
			<p/>
		</xsl:for-each>
		<!--      ************************************** /UNIT*********************************************  -->
		<!--      *********************************** RIGHTS ******************************************** -->
		<!-- this part distinguishes this stylesheet from the version used in the SimpleUI; it
			is necessary, however, since the component showing legal owner and other IPR
			data in the SimpleUI context is missing here. 
			The component expects the stylesheet ABCD1.2_CommonTemplates.xslt (also
			used by the SimpleUI to be present in the same folder.
		-->
		<xsl:if test="string(n1:DataSets/n1:DataSet/n1:DatasetDerivations/n1:DatasetDerivation/n1:Rights)">
			<h3 class="background">  Rights:</h3>
			<table border="0" bordercolor="#e4e4e4" cellpadding="5" cellspacing="5" width="100%">
					<tr valign="top">
						<td>
							<xsl:for-each select="n1:DataSets/n1:DataSet/n1:DatasetDerivations/n1:DatasetDerivation/n1:Rights">
								<xsl:call-template name="RightsTable"/>
							</xsl:for-each>
						</td>
					</tr>
			</table>
		</xsl:if>
		<!--      *********************************** /RIGHTS ******************************************** -->
	</xsl:template>
</xsl:stylesheet>
