View stylesheet

XML schemas http://biodiversity.eionet.europa.eu/schemas/bernconvention/derogations.xsd
Output type HTML
Description Habides derogations report as HTML
XSL file derogations.xsl (Last modified: 15 Oct 2013 13:35 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
       xmlns:l="http://biodiversity.eionet.europa.eu/art17dataflow"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- $Id: derogations.xsl 15096 2013-10-15 11:34:37Z roug $
     For schema http://biodiversity.eionet.europa.eu/schemas/bernconvention/derogations.xsd
  -->
<xsl:output method='html' encoding='UTF-8' indent='yes'/>

<xsl:variable name="habitatsURL" select="'http://rod.eionet.europa.eu/obligations/268'"/>
<xsl:variable name="birdsURL" select="'http://rod.eionet.europa.eu/obligations/276'"/>

<xsl:template match="/">
  <html>
  <head>
	<style>
		ul {list-style-type: none; margin: 0; padding: 0}
		span.lbl {float: right; font-weight: bold; text-align: right; padding-right: 3px; width: 100%}
		table.tbl tr td {border: solid 1px #cccccc;}
	</style>
  </head>
  <body>
  <h2>Derogations</h2>
  <h3>Country:  <xsl:value-of select="derogations/@country"/></h3>
  
  <xsl:for-each select="derogations/derogation">
	<h3> Derogation (<xsl:value-of select="./@derogation_reference"/>) (user identity: <xsl:value-of select="./@userIdentity"/>) (user derogation reference: <xsl:value-of select="./@user_derogation_ref"/>)</h3>
	<div style="padding-bottom: 7px">
		<table border="0" cellspacing="1" cellpadding="1" class="tbl">
			<tr>
				<td><span class="lbl">Directive</span></td>
				<td>
                                    <xsl:choose>
                                        <xsl:when test="./@directive = $habitatsURL or ./@directive = $birdsURL">
                                            <a>
                                            <xsl:attribute name="href">
                                                    <xsl:value-of select="./@directive"/>
                                            </xsl:attribute>
                                            <xsl:attribute name="target">new</xsl:attribute>
                                            <xsl:value-of select="./@directive"/>
                                            </a>
                                            <xsl:if test="./@directive = $habitatsURL">
                                                    (habitats)
                                            </xsl:if>
                                            <xsl:if test="./@directive = $birdsURL">
                                                    (birds)
                                            </xsl:if>
					</xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="./@directive"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Licensing authority</span></td>
				<td>
					<xsl:value-of select="licensingAuthority"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">License valid from</span></td>
				<td>
					<xsl:value-of select="licenseValidFrom"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">License valid until</span></td>
				<td>
					<xsl:value-of select="licenseValidUntil"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Sensitive</span></td>
				<td>
					<xsl:value-of select="sensitive"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Number of licenses</span></td>
				<td>
					<xsl:value-of select="numberOfLicenses"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Species</span></td>
				<td>
					<ul>
					<xsl:for-each select="./species">
                                                <xsl:if test="normalize-space(.)!=''">
                                                    <xsl:call-template name="split-species">
                                                        <xsl:with-param name="text" select="." />
                                                    </xsl:call-template>
                                                </xsl:if>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			<xsl:if test="./derogationJustification and (./@directive=$habitatsURL or ./@directive='Habitats')">
			<tr>
				<td><span class="lbl">Justification for derogation</span></td>
				<td>
					<xsl:value-of select="derogationJustification"/>
				</td>
			</tr>
			</xsl:if>
			<xsl:if test="./bioRegions and (./@directive=$habitatsURL or ./@directive='Habitats')">
			<tr>
				<td><span class="lbl">Bio geographical region</span></td>
				<td>
					<ul>
					<xsl:for-each select="./bioRegions/bioRegion">
						<li><xsl:value-of select="."/></li>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			</xsl:if>
			<tr>
				<td><span class="lbl">Region</span></td>
				<td>
					<ul>
					<xsl:for-each select="./regions/region">
						<li><xsl:value-of select="."/></li>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Location</span></td>
				<td>
					<xsl:value-of select="location"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Alternatives assessed</span></td>
				<td>
					<xsl:value-of select="alternativesAssessed"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Permitted activities</span></td>
				<td>
					<ul>
					<xsl:for-each select="./activities/activity">
						<li><xsl:value-of select="."/></li>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Permitted methods</span></td>
				<td>
					<ul>
					<xsl:for-each select="./methods/method">
						<li><xsl:value-of select="."/></li>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">License reasons</span></td>
				<td>
					<ul>
					<xsl:for-each select="./reasons/reason">
						<li><xsl:value-of select="."/></li>
					</xsl:for-each>
					</ul>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Strictly supervised conditions</span></td>
				<td>
					<xsl:value-of select="strictlySupervisedConditions"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Selective basis</span></td>
				<td>
					<xsl:value-of select="selectiveBasis"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Licensed</span></td>
				<td>
					Individuals: <xsl:value-of select="licensed/individuals"/>;
					Eggs: <xsl:value-of select="licensed/eggs"/>;
					<xsl:if test="licensed/breeding and (./@directive=$habitatsURL or ./@directive='Habitats')">
						Breeding sites: <xsl:value-of select="licensed/breeding"/>;
					</xsl:if>
					<xsl:if test="licensed/resting and (./@directive=$habitatsURL or ./@directive='Habitats')">
					Resting sites: <xsl:value-of select="licensed/resting"/>;
					</xsl:if>
					<xsl:if test="licensed/nests and (./@directive=$birdsURL or ./@directive='Birds')">
						Nests: <xsl:value-of select="licensed/nests"/>;
					</xsl:if>
					Others (unit): <xsl:value-of select="licensed/otherType"/>;
					Others (number): <xsl:value-of select="licensed/otherNumber"/>
					<xsl:if test="string-length(licensedJustification) &gt; 0">
						<br/><br/>
						<b>Justification (if no values given): </b> <xsl:value-of select="licensedJustification"/>
					</xsl:if>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Actually taken</span></td>
				<td>
					Individuals: <xsl:value-of select="actuallyTaken/individuals"/>;
					Eggs: <xsl:value-of select="actuallyTaken/eggs"/>;
					<xsl:if test="actuallyTaken/breeding and (./@directive=$habitatsURL or ./@directive='Habitats')">
						Breeding sites: <xsl:value-of select="actuallyTaken/breeding"/>;
					</xsl:if>
					<xsl:if test="actuallyTaken/resting and (./@directive=$habitatsURL or ./@directive='Habitats')">
						Resting sites: <xsl:value-of select="actuallyTaken/resting"/>;
					</xsl:if>
					<xsl:if test="actuallyTaken/nests and (./@directive=$birdsURL or ./@directive='Birds')">
						Nests: <xsl:value-of select="actuallyTaken/nests"/>;
					</xsl:if>
					Others (unit): <xsl:value-of select="actuallyTaken/otherType"/>;
					Others (number): <xsl:value-of select="actuallyTaken/otherNumber"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Population size</span></td>
				<td>
					Individuals: <xsl:value-of select="populationSize/individuals"/>;
					<xsl:if test="populationSize/breedingPairs and (./@directive=$birdsURL or ./@directive='Birds')">
						Breeding pairs: <xsl:value-of select="populationSize/breedingPairs"/>;
					</xsl:if>
					Others (unit): <xsl:value-of select="populationSize/otherType"/>;
					Others (number): <xsl:value-of select="populationSize/otherNumber"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Impact on population</span></td>
				<td>
					<xsl:value-of select="impactOnPopulation"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Supervisory measure</span></td>
				<td>
					<xsl:value-of select="supervisoryMeasure"/>
				</td>
			</tr>
			<tr>
				<td><span class="lbl">Comments</span></td>
				<td>
					<xsl:value-of select="comments"/>
				</td>
			</tr>
		</table>
	</div>
	</xsl:for-each>
  </body>
  </html>
</xsl:template>

<xsl:template name="split-species">
    <xsl:param name="text" select="."/>
    <xsl:choose>
        <xsl:when test="contains($text, ',')">
                <xsl:call-template name="get-eunis-species-code">
                    <xsl:with-param name="text" select="normalize-space(substring-before($text, ','))"/>
                </xsl:call-template>
                <xsl:call-template name="split-species">
                    <xsl:with-param name="text" select="substring-after($text, ',')"/>
                </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
                <xsl:call-template name="get-eunis-species-code">
                    <xsl:with-param name="text" select="normalize-space($text)"/>
                </xsl:call-template>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="get-eunis-species-code">
    <xsl:param name="text" select="."/>
    <xsl:choose>
      <xsl:when test="document('http://converters.eionet.europa.eu/xmlfile/map-eunis-species.xml')/l:eunis/l:species[@name=$text] != ''">
        <li><a><xsl:attribute name="href">http://eunis.eea.europa.eu/species/<xsl:value-of select="document('http://converters.eionet.europa.eu/xmlfile/map-eunis-species.xml')/l:eunis/l:species[@name=$text]"/></xsl:attribute><xsl:value-of select="$text"/></a></li>
      </xsl:when>
      <xsl:otherwise>
        <li><xsl:value-of select="$text"/></li>
      </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>