View stylesheet

XML schemas http://bd.eionet.europa.eu/schemas/Art12Art17_reporting_2013/art12_birds.xsd
Output type HTML
Description HTML factsheet
XSL file birds.xsl (Last modified: 03 Nov 2013 17:55 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml" xmlns:lookup="http://biodiversity.eionet.europa.eu/art12dataflow"
    version="1.0" exclude-result-prefixes="xml lookup">

    <xsl:import href="art12_redlist-common.xsl"/>
    <xsl:variable name="report_type" select="'birds'"/>

    <xsl:output method="xml" indent="yes"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        omit-xml-declaration="yes" />

    <xsl:param name="envelopeurl"/>
    <xsl:param name="envelopepath"/>
    <xsl:param name="filename"/>

    <xsl:variable name="isRedList"><xsl:value-of select="/bird_reports/@redlist = 'true'"/></xsl:variable>

    <xsl:template match="bird_reports">

        <html>
            <xsl:attribute name="xml:lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>

            <head>
                <title>Factsheet</title>
                <xsl:call-template name="getCss"/>
            </head>
            <body>
                <xsl:choose>
                    <xsl:when test="$isRedList = 'false'">
                        <h1>Annex 2: Bird species' status and trends reporting format for the period 2008-2012</h1>
                    </xsl:when>
                    <xsl:otherwise>
                        <h1>Bird species' status and trends</h1>
                    </xsl:otherwise>
                </xsl:choose>
                <h2>Bird Species on this report</h2>
                   <xsl:for-each select="bird_report">
                    <xsl:variable name="seasonText">
                        <xsl:call-template name="getValueLabel">
                            <xsl:with-param name="elem" select="season"/>
                        </xsl:call-template>
                    </xsl:variable>
                    <p>
                       <a><xsl:attribute name="href">
                       <xsl:value-of select="concat('#',speciescode,'_', season)"/>
                       </xsl:attribute><xsl:value-of select="concat(speciesname, ' (', speciescode, ')', $seasonText)"/></a>
                    </p>
                </xsl:for-each>

                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="bird_report">
        <xsl:variable name="season">
            <xsl:choose>
                <xsl:when test="$isRedList = 'false' and empty(index-of(('B','P','W'), upper-case(season)))">B</xsl:when>
                <xsl:when test="$isRedList = 'true' and empty(index-of(('B','W'), upper-case(season)))">B</xsl:when>
                <xsl:otherwise><xsl:value-of select="upper-case(season)"/></xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="speciesref" select="concat(speciescode,'_', season)"/>
        <a name="{$speciesref}"/>
        <h2>1. Species  Information</h2>
        <table>
              <tbody>
                <xsl:apply-templates select="country"/>
                <tr><th colspan="2" class="header_3">1.2 Species code</th></tr>
                <xsl:apply-templates select="euringcode"/>
                <xsl:apply-templates select="speciescode"/>
                <xsl:apply-templates select="speciesname"/>
                <xsl:apply-templates select="subspecies_name"/>
                <xsl:apply-templates select="alternative_speciesname"/>
                <xsl:apply-templates select="common_speciesname"/>
                <xsl:apply-templates select="season"/>
            </tbody>
        </table>

        <!-- sections 2,3 Winter, Breeding -->
        <xsl:if test="$season = 'B' or $season='W'">

        <h2>2. Population size</h2>

        <table>
              <tbody>
                <xsl:apply-templates select="population_date"/>
                <xsl:apply-templates select="population_size_unit"/>
                <xsl:apply-templates select="population_minimum_size"/>
                <xsl:apply-templates select="population_maximum_size"/>
                <xsl:apply-templates select="population_type_of_estimate"/>
                <xsl:apply-templates select="population_method"/>
                <xsl:apply-templates select="population_quality"/>
                <xsl:apply-templates select="population_sources"/>
                <!-- tr><th>2.7. Reason for change</th><td></td></tr-->
                <xsl:apply-templates select="population_additional_info"/>
            </tbody>
        </table>

         <h2>3. Population trend</h2>

        <table>
              <tbody>
                   <tr><th colspan="2" class="header_3">3.1 Short-term trend (last 12 years)</th></tr>
                <xsl:apply-templates select="population_trend_period"/>
                <xsl:apply-templates select="population_trend"/>
                <xsl:apply-templates select="population_trend_magnitude_min"/>
                <xsl:apply-templates select="population_trend_magnitude_max"/>
                <xsl:apply-templates select="population_trend_method"/>
                <xsl:apply-templates select="population_trend_quality"/>
                <xsl:apply-templates select="population_trend_sources"/>
                <tr><th colspan="2" class="header_3">3.2 Long-term trend (since c. 1980)</th></tr>
                <xsl:apply-templates select="population_trend_long_period"/>
                <xsl:apply-templates select="population_trend_long"/>
                <xsl:apply-templates select="population_trend_long_magnitude_min"/>
                <xsl:apply-templates select="population_trend_long_magnitude_max"/>
                <xsl:apply-templates select="population_trend_long_method"/>
                <xsl:apply-templates select="population_trend_long_quality"/>
                <xsl:apply-templates select="population_trend_long_sources"/>
                <xsl:apply-templates select="population_trend_additional_info"/>
            </tbody>
        </table>

        </xsl:if>
        <!-- sections 4 B only and not relevant for RedList-->
        <xsl:if test="$season = 'B' and $isRedList = 'false'">

         <h2>4. Breeding distribution map and range size</h2>

        <table>
              <tbody>
                <xsl:apply-templates select="range_period"/>
                <xsl:apply-templates select="sensitive_species"/>
                <xsl:apply-templates select="distribution_map"/>
                <xsl:apply-templates select="additional_distribution_map"/>
                <xsl:apply-templates select="range_map"/>
                <xsl:apply-templates select="range_surface_area"/>
                <xsl:apply-templates select="range_method"/>
                <xsl:apply-templates select="range_quality"/>
                <xsl:apply-templates select="range_sources"/>
                <!--  4.10 missing in 2012 -->
                <xsl:apply-templates select="range_additional_info"/>
            </tbody>
        </table>

        </xsl:if>
        <!-- sections 5 B only -->
        <xsl:if test="$season = 'B'">

        <h2>5. Breeding range trend</h2>

        <table>
              <tbody>
                   <tr><th colspan="2" class="header_3">5.1 Short-term trend (last 12 years)</th></tr>
                <xsl:apply-templates select="range_trend_period"/>
                <xsl:apply-templates select="range_trend"/>
                <xsl:apply-templates select="range_trend_magnitude_min"/>
                <xsl:apply-templates select="range_trend_magnitude_max"/>
                <xsl:apply-templates select="range_trend_method"/>
                <xsl:apply-templates select="range_trend_quality"/>
                <xsl:apply-templates select="range_trend_sources"/>
                <tr><th colspan="2" class="header_3">5.2 Long-term trend (since c. 1980)</th></tr>
                <xsl:apply-templates select="range_trend_long_period"/>
                <xsl:apply-templates select="range_trend_long"/>
                <xsl:apply-templates select="range_trend_long_magnitude_min"/>
                <xsl:apply-templates select="range_trend_long_magnitude_max"/>
                <xsl:apply-templates select="range_trend_long_method"/>
                <xsl:apply-templates select="range_trend_long_quality"/>
                <xsl:apply-templates select="range_trend_long_sources"/>
                <xsl:apply-templates select="range_trend_additional_info"/>
            </tbody>
        </table>

        </xsl:if>
        <!-- sections 6 not relevant for RedList -->
        <xsl:if test="$isRedList = 'false'">

         <h2>6. Progress in work related to international Species Action Plans (SAPs),
                Management Plans (MPs) and Brief Management Statements (BMSs)</h2>

        <table>
              <tbody>
                <xsl:apply-templates select="plan"/>
                <xsl:apply-templates select="national_plan_adopted"/>
                <xsl:apply-templates select="measures_taken"/>
                <xsl:apply-templates select="further_information"/>
            </tbody>
        </table>

        </xsl:if>
        <!-- sections 7,8 not relevant for RedList -->
        <xsl:if test="$isRedList = 'false'">

        <xsl:if test="string-length(normalize-space(string-join(pressures_threats/descendant::*/text(),''))) > 0">
            <h2>7. Main pressures and threats</h2>

            <table>
                <tbody>
                    <xsl:apply-templates select="pressures_threats"/>
                </tbody>
            </table>
         </xsl:if>

        <xsl:if test="string-length(normalize-space(string-join(./descendant::*[starts-with(name(),'spa_population')]/text(),''))) > 0 or
                        string-length(normalize-space(string-join(measures/descendant::*/text(),''))) > 0">
            <h2>8. SPA coverage and conservation measures</h2>

            <table>
                  <tbody>
                    <tr><th colspan="2" class="header_3">8.1 Population inside the SPA network</th></tr>
                    <xsl:apply-templates select="spa_population_unit"/>
                    <xsl:apply-templates select="spa_population_min"/>
                    <xsl:apply-templates select="spa_population_max"/>
                    <xsl:apply-templates select="spa_population_method"/>
                    <xsl:apply-templates select="spa_population_trend"/>

                    <xsl:apply-templates select="measures"/>
                </tbody>
            </table>
        </xsl:if>
        </xsl:if>


        <p class="report_end"> </p>
    </xsl:template>

    <xsl:template match="range_sources|range_additional_info|population_sources|population_additional_info|population_trend_additional_info|population_trend_sources|range_trend_long_sources|range_trend_additional_info|measures_taken|further_information">
        <tr>
            <th>
                <xsl:call-template name="tag-label">
                    <xsl:with-param name="tagname" select="name(.)"/>
                </xsl:call-template>
            </th>
            <td class="preserve" colspan="2">
                <xsl:if test="string-length(.)!=0">
                    <xsl:call-template name="break">
                        <xsl:with-param name="text" select="."/>
                    </xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="measures">
        <tr>
            <th scope="row" class="header_3" colspan="2">8.2 Conversation measures</th>
        </tr>
        <tr>
            <td colspan="2">
                <table>
                    <tr>
                        <th>8.2.1 Measure</th>
                        <th>8.2.2 Type</th>
                        <th>8.2.3 Ranking</th>
                        <th>8.2.4 Location</th>
                        <th>8.2.5 Broad Evaluation of the measure</th>
                    </tr>
                    <xsl:apply-templates/>
                </table>
            </td>
        </tr>

    </xsl:template>

    <xsl:template match="pressures_threats">
        <tr>
            <th>a) Pressure/Threat</th>
            <th>b) Impact</th>
            <th>c) Quality of<br/>impact assessment</th>
            <th>d) Location</th>
            <th>e) Sources</th>
        </tr>
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="measure">
        <tr>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="code"/></xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./type_legal"/>
                    <xsl:with-param name="out-text" select="'Legal '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./type_administrative"/>
                    <xsl:with-param name="out-text" select="'Administrative '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./type_contractual"/>
                    <xsl:with-param name="out-text" select="'Contractual '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./type_recurrent"/>
                    <xsl:with-param name="out-text" select="'Recurrent '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./type_oneoff"/>
                    <xsl:with-param name="out-text" select="'One Off '"/>
                </xsl:call-template>

            </td>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="ranking"/></xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./location_inside"/>
                    <xsl:with-param name="out-text" select="'Inside '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./location_outside"/>
                    <xsl:with-param name="out-text" select="'Outside '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./location_both"/>
                    <xsl:with-param name="out-text" select="'Both '"/>
                </xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./broad_evaluation_maintain"/>
                    <xsl:with-param name="out-text" select="'Maintain '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./broad_evaluation_enhance"/>
                    <xsl:with-param name="out-text" select="'Enchance '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./broad_evaluation_longterm"/>
                    <xsl:with-param name="out-text" select="'Long-term '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./broad_evaluation_noeffect"/>
                    <xsl:with-param name="out-text" select="'No Effect '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text" select="./broad_evaluation_unknown"/>
                    <xsl:with-param name="out-text" select="'Unknown '"/>
                </xsl:call-template>
                <xsl:call-template name="boolean-string">
                    <xsl:with-param name="text"
                        select="./broad_evaluation_notevaluated" />
                    <xsl:with-param name="out-text" select="'Not Evaluated '"/>
                </xsl:call-template>

            </td>
        </tr>
    </xsl:template>
    <xsl:template match="pressure_threat">
        <tr>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="code"/></xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="ranking"/></xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="quality"/></xsl:call-template>
            </td>
            <td>
                <xsl:call-template name="getValue"><xsl:with-param name="elem" select="location"/></xsl:call-template>
            </td>
            <td>
                   <xsl:if test="string-length(sources)!=0">
                    <xsl:call-template name="break">
                        <xsl:with-param name="text" select="sources"/>
                    </xsl:call-template>
                </xsl:if>

            </td>

        </tr>
    </xsl:template>




</xsl:stylesheet>