View stylesheet

XML schemas http://dd.eionet.europa.eu/schemas/mmr-article17/MMRArticle17Questionnaire.xsd
Output type HTML
Description HTML report
XSL file article17-html.xsl (Last modified: 18 Aug 2016 11:51 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                version="2.0">
    <xsl:output method="xhtml" 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:variable name="schema" select="document('http://dd.eionet.europa.eu/schemas/mmr-article17/MMRArticle17Questionnaire.xsd')/xs:schema"/>
    <!--<xsl:variable name="labels" select="document('http://converters.eionet.europa.eu/xmlfile/article17-labels.xml')/labels"/>-->
    <!--<xsl:variable name="codelists" select="document('http://converters.eionet.europa.eu/xmlfile/art17-codelists-en.xml')/Article17Codelists"/>-->


    <xsl:variable name="labelsLanguage" select="MMRArticle17Questionnaire/@labelLanguage"/>

    <xsl:variable name="xmlPath" select="'https://svn.eionet.europa.eu/repositories/Reportnet/Dataflows/MMR-Article17/xml/languages/'"/>
    <xsl:variable name="codelistsUrl">
        <xsl:choose>
            <xsl:when test="doc-available(concat($xmlPath, 'art17-codelists-', $labelsLanguage ,'.xml'))">
                <xsl:value-of select="concat($xmlPath, 'art17-codelists-', $labelsLanguage ,'.xml')"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="concat($xmlPath, 'art17-codelists-en.xml')"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="codelists" select="document($codelistsUrl)/Article17Codelists"/>

    <xsl:variable name="labelsUrl">
        <xsl:choose>
            <xsl:when test="doc-available(concat($xmlPath, 'art17-labels-', $labelsLanguage ,'.xml'))">
                <xsl:value-of select="concat($xmlPath, 'art17-labels-', $labelsLanguage ,'.xml')"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="concat($xmlPath, '../article17-labels.xml')"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="labels" select="document($labelsUrl)/labels"/>


    <!-- parameters for testing at localhost -->

    <!-- <xsl:variable name="codelists" select="document('../xml/languages/art17-codelists-en.xml')/Article17Codelists"/>-->
    <!--<xsl:variable name="schema" select="document('../schema/MMRArticle17Questionnaire.xsd')/xs:schema"/>-->
    <!-- <xsl:variable name="labels" select="document('../xml/article17-labels.xml')/labels"/> -->
    <xsl:template match="/">
        <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <title>EU-ETS Article 17 questionnaire</title>
                <meta content="text/html; charset=utf-8"/>
                <style type="text/css">
                    body {
                        font-size: 80%;
                        font-family: verdana, helvetica, arial, sans-serif;
                        color: #333;
                        margin-left:30px;
                    }
                    h1 {
                        font-size: 160%;
                        color: #315076;
                        text-align: center;
                        padding-bottom: 0.5em;
                        font-style: italic;
                    }
                    h2 {
                        font-size: 130%;
                        border-bottom: 1px solid #999999;
                        font-style: italic;
                        margin-left:-25px;
                    }
                    h3{
                        font-size: 110%;
                        color: #315076;
                        margin-left:-25px;
                    }
                    h4{
                        font-size: 110%;
                        color: #315076;
                        margin-top: 10px;
                        margin-bottom: 5px;
                    }
                    caption {
                        display: none;
                        font-family: vardana, verdana, helvetica, arial, sans-serif;
                        text-align: left;
                        font-size: 150%;
                    }

                    table {
                        border-collapse: collapse;
                    }
                    th, td{
                        padding: 0.5em 0.5em 0.5em 0.5em;
                        text-align:left;
                        border: 1px solid #bbb;
                    }
                    th {
                        background-color: #f9f8f6;
                        text-align: left;
                        vertical-align: bottom;

                    }
                    td{
                        text-align: left;
                        vertical-align: text-top;
                    }
                    table.datatable {
                        width: 100%;
                    }

                    table.question{
                        margin-top: 13px;
                    }
                    table.question th, table.question td{
                        vertical-align: top;
                        border: none;
                    }
                    table.question th{
                        font-size: 105%;
                        color: #315076;
                        background-color: transparent;
                        padding-left: 0;
                    }
                    table.second{
                        margin-top: 5px;
                    }
                    .sub {
                        font-size: 0.8em;
                    }

                    sup {
                        font-size: 0.8em;
                        font-style: italic;
                        color: #777;
                    }
                    .note{
                        font-size: 0.8em;
                        color: #315076;
                    }
                    .value {
                        background-color: #ffffe0;
                    }
                    .disabled td{
                        background-color:lightgrey;
                    }
                    .italicTableHeading{
                        font-style: italic;
                        color: black;
                        margin-left: 1em;
                    }
                    .total {
                        font-weight: bold;
                    }
                </style>

            </head>
            <body>
                <h1>
                    <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Questionnaire-title'"/>
                    </xsl:call-template>
                </h1>
                <table>
                    <tr>
                        <th>Reporting language</th>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="/*/@labelLanguage"/></xsl:call-template>
                    </tr>
                    <tr>
                        <th>Reporting year</th>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="/*/@year"/></xsl:call-template>
                    </tr>
                </table>
                <xsl:apply-templates />
            </body>
        </html>
    </xsl:template>

    <xsl:template match="Table1">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Table1'"/>
            </xsl:call-template>
        </h2>
        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th rowspan="2" class="span8"></th>
                    <th colspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'AmountForTheYear'"/>
                        </xsl:call-template>
                    </th>
                </tr>
                <tr>
                    <th class="span4">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'ThousandEuros'"/>
                        </xsl:call-template>
                    </th>
                    <th class="span4">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'ThousandEurosInDomestic'"/>
                        </xsl:call-template>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr class="total">
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-TotalAuctioningAllowancesGenerated'"/>
                        </xsl:call-template>
                    </td>
                    <td>
                        <xsl:value-of select="sum(./*[local-name()= 'AuctioningAllowancesOfArticle3dGenerated' or local-name()= 'AuctioningAllowancesOfArticle10Generated']/Euros[number(.)=number(.)])"/>
                     </td>
                    <td>
                        <xsl:value-of select="sum(./*[local-name()= 'AuctioningAllowancesOfArticle3dGenerated' or local-name()= 'AuctioningAllowancesOfArticle10Generated']/LocalCurrency[number(.)=number(.)])"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-AuctioningAllowancesOfArticle10Generated'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle10Generated/Euros"/></xsl:call-template>


                       <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle10Generated/LocalCurrency"/></xsl:call-template>
                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-AuctioningAllowancesOfArticle3dGenerated'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle3dGenerated/Euros"/></xsl:call-template>

                       <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle3dGenerated/LocalCurrency"/></xsl:call-template>

                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-TotalAuctioningAllowancesUsed'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="TotalAuctioningAllowancesUsed/Euros"/></xsl:call-template>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="TotalAuctioningAllowancesUsed/LocalCurrency"/></xsl:call-template>

                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-AuctioningAllowancesOfArticle10Used'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle10Used/Euros"/></xsl:call-template>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle10Used/LocalCurrency"/></xsl:call-template>

                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-AuctioningAllowancesOfArticle3dUsed'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle3dUsed/Euros"/></xsl:call-template>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AuctioningAllowancesOfArticle3dUsed/LocalCurrency"/></xsl:call-template>

                </tr>
                <tr>
                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-TotalAuctioningAllowancesUsedAndGenerated'"/>
                        </xsl:call-template>
                    </td>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="TotalAmountOfAuctioningRevenuesGeneratedAndUsed/Euros"/></xsl:call-template>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="TotalAmountOfAuctioningRevenuesGeneratedAndUsed/LocalCurrency"/></xsl:call-template>

                </tr>
                <tr>
                    <td colspan="3">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-ExplanationOnMethodologyOfCurrencyExchange'"/>
                        </xsl:call-template>
                    </td>
                </tr>
                <tr>
                    <xsl:call-template name="getValueTd">
                        <xsl:with-param name="elem" select="MethodologyOnCurrencyExchange"/>
                        <xsl:with-param name="colspan" select="3"/>
                    </xsl:call-template>
                </tr>
                <tr>
                    <td colspan="3">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table1-ExplanationOnMethodologyOfCommitmentAndDisbursement'"/>
                        </xsl:call-template>
                    </td>
                </tr>
                <tr>
                    <xsl:call-template name="getValueTd">
                        <xsl:with-param name="elem" select="MethodologyOnCommitmentAndDisbursement"/>
                        <xsl:with-param name="colspan" select="3"/>
                    </xsl:call-template>
                </tr>
            </tbody>
        </table>
        <div class="note">
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Notes'"/>
            </xsl:call-template>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table1-Note'"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>
    <xsl:template match="Table2">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Table2'"/>
            </xsl:call-template>
        </h2>
        <xsl:call-template name="getTable2">
            <xsl:with-param name="colHeaders" select="'Table2-PurposeForRevenues|Table2-ShortDescription|Table2-Status|Table2-RevenuesPursuantTo|Table2-TypeOfUse|Table2-FinancialInstrument|Table2-ImplementingAgency|AdditionalInfo'"/>
            <xsl:with-param name="curElem" select="."/>
        </xsl:call-template>

        <div class="note">
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Notes'"/>
            </xsl:call-template>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table2-Note1'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table2-Note2'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table2-Note3'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table2-Note4'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table2-Note5'"/>
                </xsl:call-template>
            </div>
        </div>

    </xsl:template>
    <xsl:template match="Table3">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Table3'"/>
            </xsl:call-template>
        </h2>
        <table class="table table-hover table-bordered">
        <thead>
            <tr>

                <th  class="span6" rowspan="2">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'Table3-Heading1'"/>
                    </xsl:call-template>
                </th>
                <th colspan="2" class="span4">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'Table3-Heading2'"/>
                    </xsl:call-template>
                </th>
                <th colspan="2" class="span4">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'Table3-Heading3'"/>
                    </xsl:call-template>
                </th>
            </tr>
            <tr>

                <th class="span2">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'ThousandEuros'"/>
                    </xsl:call-template>
                </th>
                <th class="span2">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'ThousandEurosInDomestic'"/>
                    </xsl:call-template>
                </th>
                <th class="span2">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'ThousandEuros'"/>
                    </xsl:call-template>
                </th>
                <th class="span2">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'ThousandEurosInDomestic'"/>
                    </xsl:call-template>
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <xsl:call-template name="getLabelInCodelist">
                        <xsl:with-param name="labelName" select="'ThirdWorldCountries'"/>
                        <xsl:with-param name="schemaElementName" select="'Table3TypeOfSupportsType'"/>
                    </xsl:call-template>
                </td>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='ThirdWorldCountries']/AmountCommitted/Euros"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='ThirdWorldCountries']/AmountCommitted/LocalCurrency"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='ThirdWorldCountries']/AmountDisbursed/Euros"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='ThirdWorldCountries']/AmountDisbursed/LocalCurrency"/></xsl:call-template>

            </tr>
            <tr>
                <td>
                    <xsl:call-template name="getLabelInCodelist">
                        <xsl:with-param name="labelName" select="'DevelopedCountries'"/>
                        <xsl:with-param name="schemaElementName" select="'Table3TypeOfSupportsType'"/>
                    </xsl:call-template>
                </td>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='DevelopedCountries']/AmountCommitted/Euros"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='DevelopedCountries']/AmountCommitted/LocalCurrency"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='DevelopedCountries']/AmountDisbursed/Euros"/></xsl:call-template>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="FixedQuestion[./TypeOfSupport ='DevelopedCountries']/AmountDisbursed/LocalCurrency"/></xsl:call-template>

            </tr>
            <tr>

                    <td>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table3-EventualExplanation'"/>
                        </xsl:call-template>
                    </td>

                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="EventualExplanation"/><xsl:with-param name="colspan" select="4"/></xsl:call-template>
            </tr>
        </tbody>
        </table>
        <div class="note">
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Notes'"/>
            </xsl:call-template>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table3-Note1'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table3-Note2'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table3-Note3'"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>
    <xsl:template match="Table4">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Table4'"/>
            </xsl:call-template>
        </h2>

        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th rowspan="2" />
                    <th colspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'AmountForTheYear'"/>
                        </xsl:call-template>
                    </th>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel" >
                            <xsl:with-param name="labelName" select="'Table4-Status'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-TypeOfSupport'"/>
                        </xsl:call-template>
                    </th>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-TypeOfFinancialInstrument'"/>
                        </xsl:call-template>
                    </th>

                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-Sector'"/>
                        </xsl:call-template>
                    </th>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'InformationNotAvailable'"/>
                        </xsl:call-template>
                    </th>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'AdditionalInfo'"/>
                        </xsl:call-template>
                    </th>
                </tr>
                <tr>

                    <th>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'ThousandEuros'"/>
                        </xsl:call-template>
                    </th>
                    <th>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-ThousandEurosInDomestic'"/>
                        </xsl:call-template>
                    </th>

                </tr>
            </thead>
            <tbody>
                <xsl:for-each select="MultiLiteralChannels/FixedQuestion">
                <tr>
                    <td>
                        <!--<xsl:variable name="cols" select="tokenize($codelists/Table4UseOfRevenues/*/code, ' ')"/>
                        <xsl:for-each select="$cols">
                            <xsl:value-of select="."/>-->
                        <xsl:call-template name="getLabelInCodelist">
                            <xsl:with-param name="labelName" select="./UseOfRevenue"/>
                            <xsl:with-param name="schemaElementName" select="'Table4UseOfRevenuesType'"/>
                        </xsl:call-template>

                    </td>
                    <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/Euros"/></xsl:call-template>
                    <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/LocalCurrency"/></xsl:call-template>
                    <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                        <xsl:with-param name="elementType" select="'CommittedDisbursedStatusType'"/>
                    </xsl:call-template>
                    <xsl:call-template name="getValueTd">
                        <xsl:with-param name="elem" select="TypeOfSupport"/>
                        <xsl:with-param name="codelistElement" select="'Table4TypeOfSupportsType'"/>
                    </xsl:call-template>
                    <xsl:call-template name="getListTd">
                        <xsl:with-param name="elem" select="FinancialInstrument"/>
                        <xsl:with-param name="parentElem" select="."/>
                        <xsl:with-param name="elementType" select="'Table4FinancialInstruments'"/>
                    </xsl:call-template>
                    <xsl:call-template name="getListTd">
                        <xsl:with-param name="elem" select="Sector"/>
                        <xsl:with-param name="parentElem" select="."/>
                        <xsl:with-param name="elementType" select="'Table4Sectors'"/>
                    </xsl:call-template>
                    <xsl:call-template name="getValueTd">
                        <xsl:with-param name="elem" select="InformationNotAvailable"/>
                    </xsl:call-template>
                    <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>
                </tr>
                </xsl:for-each>
                <xsl:if test="(count(MultiLiteralChannels/*[./local-name() = 'OtherPleaseSpecify']) &gt; 1 ) or (string-length(MultiLiteralChannels/*[./local-name() = 'OtherPleaseSpecify'][1]/OtherDescription) &gt; 0)">
                    <xsl:for-each select="MultiLiteralChannels/OtherPleaseSpecify">
                        <xsl:if test="(string-length(./OtherDescription) &gt; 0)">
                        <tr>
                            <td>
                                <xsl:call-template name="getLabel">
                                    <xsl:with-param name="labelName" select="'Table4-OtherMultilateralFunds'"/>
                                </xsl:call-template>
                                <xsl:value-of select="OtherDescription"/>
                            </td>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/Euros"/></xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/LocalCurrency"/></xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                                    <xsl:with-param name="elementType" select="'CommittedDisbursedStatusType'"/>
                                </xsl:call-template>

                                <xsl:call-template name="getValueTd">
                                    <xsl:with-param name="elem" select="TypeOfSupport"/>
                                    <xsl:with-param name="codelistElement" select="'Table4TypeOfSupportsType'"/>
                                </xsl:call-template>
                                <xsl:call-template name="getListTd">
                                    <xsl:with-param name="elem" select="FinancialInstrument"/>
                                    <xsl:with-param name="parentElem" select="."/>
                                    <xsl:with-param name="elementType" select="'Table4FinancialInstruments'"/>
                                </xsl:call-template>

                                <xsl:call-template name="getListTd">
                                    <xsl:with-param name="elem" select="Sector"/>
                                    <xsl:with-param name="parentElem" select="."/>
                                    <xsl:with-param name="elementType" select="'Table4Sectors'"/>
                                </xsl:call-template>
                                <xsl:call-template name="getValueTd">
                                    <xsl:with-param name="elem" select="InformationNotAvailable"/>
                                </xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>

                        </tr>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:if>
                <xsl:for-each select="MultilateralFinancialInstitutions/FixedQuestion">
                    <tr>
                        <td>
                            <!--<xsl:variable name="cols" select="tokenize($codelists/Table4UseOfRevenues/*/code, ' ')"/>
                            <xsl:for-each select="$cols">
                                <xsl:value-of select="."/>-->
                            <xsl:call-template name="getLabelInCodelist">
                                <xsl:with-param name="labelName" select="./UseOfRevenue"/>
                                <xsl:with-param name="schemaElementName" select="'Table4UseOfRevenuesType'"/>
                            </xsl:call-template>

                        </td>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/Euros"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/LocalCurrency"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                            <xsl:with-param name="elementType" select="'CommittedDisbursedStatusType'"/>
                        </xsl:call-template>
                        <xsl:call-template name="getValueTd">
                            <xsl:with-param name="elem" select="TypeOfSupport"/>
                            <xsl:with-param name="codelistElement" select="'Table4TypeOfSupportsType'"/>
                        </xsl:call-template>
                        <xsl:call-template name="getListTd">
                            <xsl:with-param name="elem" select="FinancialInstrument"/>
                            <xsl:with-param name="parentElem" select="."/>
                            <xsl:with-param name="elementType" select="'Table4FinancialInstruments'"/>
                        </xsl:call-template>
                        <xsl:call-template name="getListTd">
                            <xsl:with-param name="elem" select="Sector"/>
                            <xsl:with-param name="parentElem" select="."/>
                            <xsl:with-param name="elementType" select="'Table4Sectors'"/>
                        </xsl:call-template>
                        <xsl:call-template name="getValueTd">
                            <xsl:with-param name="elem" select="InformationNotAvailable"/>
                        </xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>
                    </tr>
                </xsl:for-each>
                <xsl:if test="(count(MultilateralFinancialInstitutions/*[./local-name() = 'OtherPleaseSpecify']) &gt; 1 ) or (string-length(MultilateralFinancialInstitutions/*[./local-name() = 'OtherPleaseSpecify'][1]/OtherDescription) &gt; 0)">
                    <xsl:for-each select="MultilateralFinancialInstitutions/OtherPleaseSpecify">
                        <xsl:if test="(string-length(./OtherDescription) &gt; 0)">
                            <tr>
                                <td>
                                    <xsl:call-template name="getLabel">
                                        <xsl:with-param name="labelName" select="'Table4-OtherMultilateralFunds'"/>
                                    </xsl:call-template>
                                    <xsl:value-of select="OtherDescription"/>
                                </td>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/Euros"/></xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/LocalCurrency"/></xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                                    <xsl:with-param name="elementType" select="'CommittedDisbursedStatusType'"/>
                                </xsl:call-template>
                                <xsl:call-template name="getValueTd">
                                    <xsl:with-param name="elem" select="TypeOfSupport"/>
                                    <xsl:with-param name="codelistElement" select="'Table4TypeOfSupportsType'"/>
                                </xsl:call-template>
                                <xsl:call-template name="getListTd">
                                    <xsl:with-param name="elem" select="FinancialInstrument"/>
                                    <xsl:with-param name="parentElem" select="."/>
                                    <xsl:with-param name="elementType" select="'Table4FinancialInstruments'"/>
                                </xsl:call-template>

                                <xsl:call-template name="getListTd">
                                    <xsl:with-param name="elem" select="Sector"/>
                                    <xsl:with-param name="parentElem" select="."/>
                                    <xsl:with-param name="elementType" select="'Table4Sectors'"/>
                                </xsl:call-template>
                                <xsl:call-template name="getValueTd">
                                    <xsl:with-param name="elem" select="InformationNotAvailable"/>
                                </xsl:call-template>
                                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>

                            </tr>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:if>
            </tbody>
        </table>
        <div class="note">
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Notes'"/>
            </xsl:call-template>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note1'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note2'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note3'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note4'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note5'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note6'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note7'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table4-Note8'"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>
    <xsl:template match="Table5">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Table5'"/>
            </xsl:call-template>
        </h2>
        <xsl:variable name="isOther" select="./*/FinancialInstrument='Other'"/>
        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table5-Programme'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table5-Recipient'"/>
                        </xsl:call-template>
                    </th>
                    <th colspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'AmountForTheYear'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-Status'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table5-TypeOfSupport'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-Sector'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-TypeOfFinancialInstrument'"/>
                        </xsl:call-template>
                    </th>

                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table2-ImplementingAgency'"/>
                        </xsl:call-template>
                    </th>
                    <th rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'InformationNotAvailable'"/>
                        </xsl:call-template>
                    </th>
                    <th  rowspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'AdditionalInfo'"/>
                        </xsl:call-template>
                    </th>
                </tr>
                <tr>

                    <th >
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'ThousandEuros
                            '"/>
                        </xsl:call-template>
                    </th>
                    <th >
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table4-ThousandEurosInDomestic'"/>
                        </xsl:call-template>
                    </th>
                </tr>
            </thead>
            <tbody>
                <xsl:for-each select="./*" >
                    <tr>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Programme"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Recipient"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/Euros"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountCommitted/LocalCurrency"/></xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                            <xsl:with-param name="elementType" select="'CommittedDisbursedStatusType'"/>
                        </xsl:call-template>

                        <xsl:call-template name="getValueTd">
                            <xsl:with-param name="elem" select="TypeOfSupport"/>
                            <xsl:with-param name="codelistElement" select="'Table5TypeOfSupportsType'"/>
                        </xsl:call-template>

                        <xsl:call-template name="getListTd">
                            <xsl:with-param name="elem" select="Sector"/>
                            <xsl:with-param name="parentElem" select="."/>
                            <xsl:with-param name="elementType" select="'Table4Sectors'"/>
                        </xsl:call-template>
                        <xsl:call-template name="getListTd">
                            <xsl:with-param name="elem" select="FinancialInstrument"/>
                            <xsl:with-param name="parentElem" select="."/>
                            <xsl:with-param name="elementType" select="'Table5FinancialInstruments'"/>
                        </xsl:call-template>

                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="ImplementingAgency"/></xsl:call-template>
                        <xsl:call-template name="getValueTd">
                            <xsl:with-param name="elem" select="InformationNotAvailable"/>
                        </xsl:call-template>
                        <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>
                    </tr>
                </xsl:for-each>
            </tbody>
        </table>
        <div class="note">
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'Notes'"/>
            </xsl:call-template>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note1'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note2'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note3'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note4'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note5'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note6'"/>
                </xsl:call-template>
            </div>
            <div class="note">
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'Table5-Note7'"/>
                </xsl:call-template>
            </div>
        </div>
    </xsl:template>


    <xsl:template name="getLabel" >
        <xsl:param name="labelName"/>
        <!--<xsl:param name="lang" select="'en'"/>-->
        <xsl:variable name="labelValue" select="$labels/*[local-name() = $labelName]"/>
        <xsl:choose>
            <xsl:when test="string-length($labelValue) &gt; 0">
                <xsl:choose>
                    <xsl:when test="contains($labelValue,'{{reportingYear}}')">
                        <xsl:value-of select="replace($labelValue,'\{\{reportingYear\}\}', string(../@year))"/>
                    </xsl:when>
                    <xsl:otherwise><xsl:value-of disable-output-escaping="yes" select="$labelValue"/> </xsl:otherwise>
                </xsl:choose>

            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of disable-output-escaping="yes" select="$labelName"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="getLabelInCodelist" >
        <xsl:param name="labelName"/>

        <xsl:param name="schemaElementName" select="''"/>
        <xsl:param name="codelistElementName"  select="substring($schemaElementName,1,number(string-length($schemaElementName)-4))"/>
        <!--<xsl:param name="lang" select="'en'"/>-->
        <xsl:variable name="codelistValue" select="$codelists/*[local-name() = $codelistElementName]/*/label[../code = $labelName]"/>
        <xsl:choose>
            <xsl:when test="string-length($codelistValue) &gt; 0">
                <xsl:value-of select="$codelistValue"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="labelValue" select="$schema/xs:simpleType[@name = $schemaElementName]//xs:enumeration[@value = $labelName]/xs:annotation/xs:documentation"/>
                <xsl:choose>
                    <xsl:when test="string-length($labelValue[1]) &gt; 0">
                              <xsl:value-of select="$labelValue"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$labelName"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="getValueTd">
        <xsl:param name="elem"/>
        <xsl:param name="elementType" select="''"/>
        <xsl:param name="colspan" select="0"/>
        <xsl:param name="isLink" select="false()"/>
        <xsl:param name="codelistElement" select="''"/>
        <xsl:variable name="codelistName">
            <xsl:if test="not(starts-with($elementType, 'String') or starts-with($elementType, 'Memo') or starts-with($elementType, 'Decimal')
                or starts-with($elementType, 'Integer')) and count($schema/xs:simpleType[@name = $elementType]//xs:enumeration[@value = $elem]) &gt; 0">
                <xsl:value-of select="$elementType"/>
            </xsl:if>
        </xsl:variable>

        <td>
            <xsl:attribute name="class">
                <xsl:value-of select="concat('value td-',position())"/>
            </xsl:attribute>
            <xsl:if test="$colspan > 0">
                <xsl:attribute name="colspan" select="$colspan"/>
            </xsl:if>
            <xsl:variable name="elemValue">
                <xsl:choose>
                    <xsl:when test="string-length($codelistName) &gt; 0">
                        <xsl:value-of select="$schema/xs:simpleType[@name = $elementType]//xs:enumeration[@value = $elem]/xs:annotation/xs:documentation"/>
                    </xsl:when>
                    <xsl:when test="$elem/text()='yes'">Yes</xsl:when>
                    <xsl:when test="$elem/text()='no'">No</xsl:when>
                    <!-- detect disabled fields -->
                    <xsl:otherwise><xsl:value-of select="$elem"/></xsl:otherwise>

                </xsl:choose>
            </xsl:variable>

            <xsl:choose>
                <xsl:when test="local-name($elem) = 'InformationNotAvailable' and string($elemValue) = 'true'">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'InformationNotAvailable'"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:when test="string($elemValue) = 'true'">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'yes'"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:when test="string($elemValue) = 'false'">
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'no'"/>
                    </xsl:call-template></xsl:when>
                <xsl:otherwise>
                    <xsl:choose>
                        <xsl:when test="$codelistElement  = 'CommittedDisbursedStatusType' or $elementType = 'CommittedDisbursedStatusType'">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="replace(replace($elem,'committed','Committed') , 'disbursed', 'Disbursed')"/>

                            </xsl:call-template>
                        </xsl:when>
                        <xsl:when test="$codelistElement  = 'Table4TypeOfSupportsType'">
                            <xsl:call-template name="getLabelInCodelist">
                                <xsl:with-param name="labelName" select="$elem"/>
                                <xsl:with-param name="schemaElementName" select="'Table4TypeOfSupportsType'"/>
                            </xsl:call-template>
                        </xsl:when>
                        <xsl:when test="$codelistElement  = 'Table5TypeOfSupportsType'">
                            <xsl:call-template name="getLabelInCodelist">
                                <xsl:with-param name="labelName" select="$elem"/>
                                <xsl:with-param name="schemaElementName" select="'Table5TypeOfSupportsType'"/>
                            </xsl:call-template>
                        </xsl:when>
                        <xsl:when test="string-length($codelistElement) &gt; 0">
                            <xsl:call-template name="getLabelInCodelist">
                                <xsl:with-param name="labelName" select="$elem"/>
                                <xsl:with-param name="schemaElementName" select="$codelistElement"/>
                            </xsl:call-template>
                        </xsl:when>

                        <xsl:when test="$isLink = true() and starts-with($elemValue, 'http')">
                            <xsl:element name="a">
                                <xsl:attribute name="href">
                                    <xsl:value-of select="$elemValue"/>
                                </xsl:attribute>
                                <xsl:value-of select="$elemValue"/>
                            </xsl:element>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:call-template name="break">
                                <xsl:with-param name="text" select="$elemValue"/>
                            </xsl:call-template>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
            </xsl:choose>
        </td>
    </xsl:template>

    <xsl:template name="getListTd">
        <xsl:param name="elem"/>
        <xsl:param name="parentElem"/>
        <xsl:param name="elementType" select="''"/>
        <xsl:param name="colspan" select="0"/>

        <xsl:variable name="codelistName">
            <xsl:if test="string-length($elementType) &gt; 0">
                <xsl:value-of select="$elementType"/>
            </xsl:if>
        </xsl:variable>

        <td>
            <xsl:attribute name="class">
                <xsl:value-of select="concat('value td-',position())"/>
            </xsl:attribute>
            <xsl:if test="$colspan > 0">
                <xsl:attribute name="colspan" select="$colspan"/>
            </xsl:if>
            <ul>
                <xsl:for-each select="$parentElem/$elem">
                    <xsl:if test="string-length(.) &gt; 0">
                        <li>
                            <xsl:variable name="arrayElement">
                                <xsl:value-of select="."/>
                            </xsl:variable>
                            <xsl:variable name="elemValue">
                                <xsl:choose>
                                    <!--
                                    <xsl:when test="string-length($codelistName) &gt; 0">
                                        <xsl:value-of select="$schema/xs:simpleType[@name = $elementType]//xs:enumeration[@value = $arrayElement]/xs:annotation/xs:documentation"/>
                                    </xsl:when>
                                    -->
                                    <xsl:when test="$arrayElement/text()='yes'">Yes</xsl:when>
                                    <xsl:when test="$arrayElement/text()='no'">No</xsl:when>
                                    <!-- detect disabled fields -->
                                    <xsl:otherwise><xsl:value-of select="$arrayElement"/></xsl:otherwise>
                                </xsl:choose>
                            </xsl:variable>
                            <xsl:choose>
                                <xsl:when test="string($elemValue) = 'true'">
                                    <xsl:call-template name="getLabel">
                                        <xsl:with-param name="labelName" select="'yes'"/>
                                    </xsl:call-template>
                                </xsl:when>
                                <xsl:when test="string($elemValue) = 'false'">
                                    <xsl:call-template name="getLabel">
                                        <xsl:with-param name="labelName" select="'no'"/>
                                    </xsl:call-template>
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:variable name="labelValue" select="$codelists/*[local-name()=$codelistName]/item[code = $elemValue]/label"/>
                                    <xsl:choose>
                                        <xsl:when test="string-length($labelValue) &gt; 0">
                                            <xsl:value-of select="$labelValue"/>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="$elemValue"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </xsl:otherwise>
                            </xsl:choose>
                        </li>
                    </xsl:if>
                </xsl:for-each>
            </ul>
        </td>
    </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="getTable2">
        <xsl:param name="colHeaders" select="''"/>
        <xsl:param name="otherPleaseSpecify" select="''"/>
        <xsl:param name="curElem" select="."/>

        <table  class="datatable">
        <thead>
            <xsl:if test="string-length(normalize-space(replace($colHeaders,'\|',''))) &gt; 0">
           <xsl:variable name="headLenght" select="string-length(normalize-space(replace($colHeaders,'\|','')))"/>
                <xsl:if test="./local-name()='Table2'">
                    <tr>
                        <th class="th-1" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-PurposeForRevenues'"/>
                            </xsl:call-template>
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-PurposeForRevenues-sample'"/>
                            </xsl:call-template>
                        </th>
                        <th class="th-2" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-ShortDescription'"/>
                            </xsl:call-template>
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-ShortDescription-sample'"/>
                            </xsl:call-template>
                        </th>
                        <th colspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-AmountForYear'"/>
                            </xsl:call-template>
                        </th>
                        <th class="th-5" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-Status'"/>
                            </xsl:call-template>
                        </th>
                        <th colspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-RevenuesPursuantTo'"/>
                            </xsl:call-template>
                        </th>


                        <th class="th-8" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-TypeOfUse'"/>
                            </xsl:call-template>
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-TypeOfUse-sample'"/>
                            </xsl:call-template>
                        </th>
                        <th class="th-9" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-FinancialInstrument'"/>
                            </xsl:call-template>
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-ImplementingAgency-sample'"/>
                            </xsl:call-template>
                        </th>
                        <th class="th-10" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-ImplementingAgency'"/>
                            </xsl:call-template>
                        </th>
                        <th class="th-11" rowspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'AdditionalInfo'"/>
                            </xsl:call-template>
                        </th>

                        <!--<th colspan="3"><xsl:value-of select="contains(./*/FinancialInstrument,'Other')"></xsl:value-of> </th>-->
                    </tr>
                </xsl:if>
                <tr>
                    <xsl:choose>
                        <xsl:when test="./local-name()='Table2'">

                            <th class="th-3">
                                <xsl:call-template name="getLabel">
                                    <xsl:with-param name="labelName" select="'ThousandEuros'"/>
                                </xsl:call-template>
                            </th>
                            <th class="th-4">
                                <xsl:call-template name="getLabel">
                                    <xsl:with-param name="labelName" select="'Table2-ThousandEurosInDomestic'"/>
                                </xsl:call-template>
                            </th>
                            <th class="th-6" >
                                <xsl:call-template name="getLabel">
                                    <xsl:with-param name="labelName" select="'Table2-Article3D'"/>
                                </xsl:call-template>
                            </th>
                            <th class="th-7" >
                                <xsl:call-template name="getLabel">
                                    <xsl:with-param name="labelName" select="'Table2-Article10'"/>
                                </xsl:call-template>
                            </th>

                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:variable name="cols" select="tokenize($colHeaders, '\|')"/>

                            <xsl:for-each select="$cols">
                                <th>
                                    <xsl:attribute name="class">
                                        <xsl:value-of select="concat('th-',position())"/>
                                    </xsl:attribute>
                                    <xsl:call-template name="getLabel">
                                        <xsl:with-param name="labelName" select="."/>
                                    </xsl:call-template>
                                </th>
                            </xsl:for-each>
                        </xsl:otherwise>
                    </xsl:choose>
                </tr>
            </xsl:if>
        </thead>
        <tbody>
             <xsl:for-each select="$curElem/QuestionRow">
                 <tr>
                     <xsl:choose>
                         <xsl:when test="../local-name()='Table2' ">
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="PurposeForRevenues"/></xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="ShortDescription"/></xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountForYear/Euros"/></xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AmountForYear/LocalCurrency"/></xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="Status"/>
                                 <xsl:with-param name="codelistElement" select="'CommittedDisbursedStatusType'"/>
                             </xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="RevenuesPursuantToArticle3d"/></xsl:call-template>
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="RevenuesPursuantToArticle10"/></xsl:call-template>
                             <!--<xsl:call-template name="getValueTd">
                                 <xsl:with-param name="elem" select="TypeOfUse"/>
                                 <xsl:with-param name="elementType" select="'TypeOfUseType'"/>
                             </xsl:call-template>
                             -->
                             <xsl:call-template name="getListTd">
                                 <xsl:with-param name="elem" select="TypeOfUse"/>
                                 <xsl:with-param name="parentElem" select="."/>
                                 <xsl:with-param name="elementType" select="'Table2TypeOfUses'"/>
                             </xsl:call-template>
                             <xsl:call-template name="getListTd">
                                 <xsl:with-param name="elem" select="FinancialInstrument"/>
                                 <xsl:with-param name="parentElem" select="."/>
                                 <xsl:with-param name="elementType" select="'Table2FinancialInstruments'"/>
                             </xsl:call-template>


                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="ImplementingAgency"/></xsl:call-template>
                           <!-- <td>
                                <xsl:value-of select="../*/FinancialInstrument"/>
                                </td>
                            -->
                             <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="AdditionalInfo"/></xsl:call-template>
                         </xsl:when>
                        <xsl:otherwise>
                            <xsl:for-each select="./*">
                                 <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="."/></xsl:call-template>
                            </xsl:for-each>
                        </xsl:otherwise>
                     </xsl:choose>

                   </tr>

                </xsl:for-each>
                <xsl:if test="$curElem/local-name()='Table2'">
                <tr>
                    <td colspan="2">
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'Table2-TotalAmountCommitted'"/>
                        </xsl:call-template>
                    </td>

                    <td>
                        <xsl:value-of select="sum($curElem/QuestionRow[./Status='committed']/AmountForYear/Euros[number(.)=number(.)])" />

                    </td>
                    <td>
                        <xsl:value-of select="sum($curElem/QuestionRow[./Status='committed']/AmountForYear/LocalCurrency[number(.)=number(.)])" />

                    </td>
                    <td colspan="7"/>
                </tr>
                    <tr>
                        <td colspan="2">
                            <xsl:call-template name="getLabel">
                                <xsl:with-param name="labelName" select="'Table2-TotalAmountDisbursed'"/>
                            </xsl:call-template>
                        </td>

                        <td>
                            <xsl:value-of select="sum($curElem/QuestionRow[./Status='disbursed']/AmountForYear/Euros[number(.)=number(.)])" />

                        </td>
                        <td>
                            <xsl:value-of select="sum($curElem/QuestionRow[./Status='disbursed']/AmountForYear/LocalCurrency[number(.)=number(.)])" />

                        </td>
                        <td colspan="7"/>
                    </tr>
                </xsl:if>
        </tbody>
        </table>





    </xsl:template>
</xsl:stylesheet>