View stylesheet

XML schemas http://bd.eionet.europa.eu/schemas/Art12Art17_reporting_2013/art12_birds_checklist.xsd
Output type HTML
Description HTML factsheet
XSL file birds-checklist.xsl (Last modified: 05 Nov 2013 11:22 )
<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: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:preserve-space elements="published reasons-specify"/>
    <xsl:template match="member_state_checklist">
        <html>
            <xsl:attribute name="xml:lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>

            <head>
                <title>Factsheet</title>
                <style type="text/css"><![CDATA[
img {
        border: 2px solid #ccc;
        margin: 10px;
}
h2 {
    font-family: arial, verdana, sans-serif;
}
h1 {
    font-size: 160%;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #999999;
}
body {
        font-size: 80%;
        font-family: verdana, helvetica, arial, sans-serif;
        color: #333;
}
caption {
        display: none;
        font-family: vardana, verdana, helvetica, arial, sans-serif;
        text-align: left;
        font-size: 150%;
}
th {
        background-color:#f6f6f6;
        text-align:left;
        vertical-align: top;
        font-weight: normal;
        color: black;
}
table {
        font-size: 100%;
        border: 1px solid #bbb;
        width: 100%;
        margin: 0 0 2em 0;
        border-collapse: collapse;

}
table table {
        border: 0px solid #bbb;
        margin: 0;
}
th, td {
        font-size: 100%;
        border: 1px solid #bbb;
}
.has_table {
        border: 0px solid #bbb;
        padding: 0;
}
th.header_3 {
    padding: 0.4em 0;
    font-size: 120%;
    font-weight: bold;
}
th.tlabel {
    width: 300px;
}
.header_info {
    margin: 20px 0px;
    padding: 5px;
    font-size: 120%;
    border: 1px dashed #999999;
    background-color: #f0f0f0;
}
.header_info div {
    margin: 5px;
}

p.report_end {

  border-bottom: dashed;
  border-width: 2px;
  border-color: #000000;
}


]]>
                </style>
            </head>
            <body>
                <h1>Check lists for Birds Directive Article 12 reporting</h1>
                <h2>Bird species for the Member State <xsl:value-of select="country/@desc"/></h2>
                <xsl:apply-templates select="birds_list"/>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="birds_list">
        The checklist contains <b><xsl:value-of select="count(bird)"/></b> birds<br/><br/>
        Predefined (not changed) items:<b><xsl:value-of select="count(bird[lower-case(predefined)='true'])"/></b> <br/>
        Changed by the member state:<b><xsl:value-of select="count(bird[lower-case(predefined)='false' and lower-case(ms_added)='false'])"/></b> <br/>
        New items added by the member state:<b><xsl:value-of select="count(bird[lower-case(ms_added)='true'])"/></b><br/>
        <br/>
        <table>
            <tbody>
                <tr>

                    <th width="15%">Bird
Species</th>

                    <th width="5%">Euring Code</th>
                    <th  width="10%">Subspecies</th>

                    <th   width="6%">Season</th>
                    <th  width="10%">Recommended pouplation unit</th>
                    <th   width="5%">SPA Trigger</th>
                    <th  width="5%">Non native</th>
                    <th   width="8%">Presence</th>

                    <th  width="31%">Comments</th>
                    <th   width="5%">Status</th>
                </tr>


                 <xsl:apply-templates/>
            </tbody>
        </table>

    </xsl:template>
    <!--xsl:template match="species">
        <h3>Species Code: <xsl:value-of select="code"/></h3>
        <h4><xsl:value-of select="name"/></h4>


        <xsl:apply-templates select="regional"/>
                <p class="report_end"> </p>
    </xsl:template-->


    <xsl:template match="bird">

        <tr>
                <td><xsl:value-of select="name"/> (<xsl:value-of select="natura_2000_code"/>)</td>
                <td>
<xsl:apply-templates select="euring_code"/>
</td>
                <td>
<xsl:apply-templates select="subspecies_unit"/>
</td>


                <td><xsl:value-of select="season/@desc"/> (<xsl:value-of select="season"/>)</td>
                <td><xsl:value-of select="population_unit/@desc"/> (<xsl:value-of select="population_unit"/>)</td>
                <td>
                    <xsl:call-template name="boolean-yesno">
                        <xsl:with-param name="text" select="spa_trigger"/>
                    </xsl:call-template>
                </td>
                <td>
                    <xsl:call-template name="boolean-yesno">
                        <xsl:with-param name="text" select="non_native"/>
                    </xsl:call-template>
                </td>
                <td><xsl:value-of select="presence/@desc"/> (<xsl:value-of select="presence"/>)</td>
                <td>
                    <xsl:apply-templates select="comments"/>
                </td>

                <td>
                    <xsl:if  test="lower-case(ms_added)='true'">
                        <xsl:attribute name="style">
                            background-color:#347C17;color:#FFFFFF
                        </xsl:attribute>
                        New
                    </xsl:if>
                    <xsl:if  test="lower-case(ms_added)='false' and lower-case(predefined)='false'">
                        <xsl:attribute name="style">
                            background-color:#F87217;color:#FFFFFF
                        </xsl:attribute>
                        Changed
                    </xsl:if>
                    <xsl:if  test="lower-case(ms_added)='false' and lower-case(predefined)='true'">
                        Predefined
                    </xsl:if>

                </td>

        </tr>

    </xsl:template>

    <xsl:template match="comments">

            <xsl:if test="string-length(.)=0">
                    N/A
            </xsl:if>
            <xsl:if test="string-length(.)!=0">
                <xsl:call-template name="break">
                    <xsl:with-param name="text" select="."/>
                </xsl:call-template>
            </xsl:if>

    </xsl:template>


    <!-- Replaces line breaks with <br/> tags -->
    <xsl:template name="break">
        <xsl:param name="text" select="."/>
        <xsl:choose>

            <xsl:when test="contains($text, '&#10;')">
                <xsl:value-of select="substring-before($text, '&#10;')" />
                <br/>
                <xsl:call-template name="break">
                    <xsl:with-param name="text" select="substring-after($text, '&#10;')" />
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>

            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="boolean-yesno">
        <xsl:param name="text" select="."/>
        <xsl:choose>
            <xsl:when test="lower-case($text)='true'">
                yes
            </xsl:when>
            <xsl:otherwise>
                no
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:template match="*">
        <xsl:value-of select="."/>
    </xsl:template>

</xsl:stylesheet>