View stylesheet

XML schema http://dd.eionet.europa.eu/schemas/ippc-wi_2014/dir200076ec_schema.xsd
Output type HTML
Description HTML report - WID factsheet 2012-2013
XSL file dir200076ec_html_2014.xsl (Last modified: 18 Sep 2014 11:40 )
<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : dir200076ec_html_2014.xsl
    Created on : 19 August 2014, 15:04
    Author     : Rait Väli
    Description:
        Purpose of transformation follows.
-->

<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="html" encoding="utf-8"/>
    <xsl:param name="xml_folder_uri"/>
    <xsl:variable name="directiveid">200076</xsl:variable>
    <xsl:param name="envelopeurl" select="''"/>
    <xsl:param name="filename" select="''"/>

    <xsl:variable name="countrycode">
        <xsl:choose>
            <xsl:when test="string-length($envelopeurl)>0"><xsl:value-of select="document(concat($envelopeurl, '/xml'))/envelope/countrycode"/> </xsl:when>
            <xsl:otherwise></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="reportingdate">
        <xsl:choose>
            <xsl:when test="string-length($envelopeurl)>0"><xsl:value-of select="substring-before(document(concat($envelopeurl, '/xml'))/envelope/date, 'T')"/> </xsl:when>
            <xsl:otherwise></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="labels"
                  select="document('https://svn.eionet.europa.eu/repositories/Reportnet/Dataflows/IPPC-WI-Directive/xml/dir200076ec_wi/dir200076ec_wi_labels-en.xml')/labels/labelSet[@xml:lang='en']"/>
    <xsl:variable name="schema" select="document('http://dd.eionet.europa.eu/schemas/ippc-wi/dir200076ec_schema.xsd')/xs:schema"/>

    <xsl:template match="text()"/>

    <xsl:template match="response">
        <html>
            <head>
                <title>
                    Factsheet of WI delivery
                </title>
                <style type="text/css">
                    table { border: 1px solid black; border-collapse: collapse; width:100%;}
                    table th, table td { text-align: left; border: 1px solid black; }
                    table caption { border: 1px solid black; font-weight: bold; height:32px;}
                    .tophead, .questionid { background-color:#CCCCCC; }
                    .newRow { background-color:#FCD5B4; height: 32px;}
                    table th{font-weight: bold; background-color:#F0FAFF; padding:3px;}
                    table td{padding:3px;vertical-align:top;}
                    table {margin-top:15px;}
                    .rowHeight {height:1.5em}
                    table table{margin-top:0em !important; padding:0px !important;}
                    .noMargin {margin-top:0em !important; padding:0px !important;}
                </style>
            </head>
            <body>
                <h1><xsl:value-of select="$labels/q-h1"/></h1>
                <table>
                    <tr>
                        <th>Reporting country</th>
                        <td><xsl:value-of select="$countrycode"/></td>
                    </tr>
                    <tr>
                        <th>CDR envelope</th>
                        <td><xsl:value-of select="$envelopeurl"/></td>
                    </tr>
                    <tr>
                        <th>File name</th>
                        <td><xsl:value-of select="$filename"/></td>
                    </tr>
                    <tr>
                        <th>Reporting date</th>
                        <td><xsl:value-of select="$reportingdate"/></td>
                    </tr>
                </table>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="q-1">
        <h3><xsl:value-of select="$labels/q-general-notes-heading"/></h3>
    <table>
        <tr>
            <tr>
                <td>
                    <xsl:value-of select="$labels/q-general-notes-1"/>
                </td>
            </tr>
            <tr>
                <td style="height:1.5;" />
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="$labels/q-general-notes-2"/>
                </td>
            </tr>
        </tr>
    </table>

        <table>

        <tr>
            <th>
                <h3><xsl:value-of select="$labels/q-1"/></h3>
            </th>
        </tr>
        <tr>
            <th>
                <xsl:value-of select="$labels/q-1-1"/>
            </th>
        </tr>
        <tr>
            <td>
                <table class="noMargin">
                    <tr>
                        <th/>
                        <th><xsl:value-of select="$labels/incineration"/></th>
                        <th><xsl:value-of select="$labels/co-incineration"/></th>
                        <th><xsl:value-of select="$labels/q-4-1-6"/></th>
                    </tr>
                    <tr>
                        <th><xsl:value-of select="$labels/q-1-1-2"/></th>
                        <td><xsl:value-of select="./q-1-1/q-1-1-1-a"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-1-b"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-1-c"/></td>
                    </tr>
                    <tr>
                        <th><xsl:value-of select="$labels/q-1-1-3"/></th>
                        <td><xsl:value-of select="./q-1-1/q-1-1-2-a"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-2-b"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-2-c"/></td>
                    </tr>
                    <tr>
                        <th><xsl:value-of select="$labels/q-1-1-4"/></th>
                        <td><xsl:value-of select="./q-1-1/q-1-1-3-a"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-3-b"/></td>
                        <td><xsl:value-of select="./q-1-1/q-1-1-3-c"/></td>
                    </tr>
                </table>
            </td>
        </tr>
        </table>
        <table  class="noMargin">
            <tr>
                <th><xsl:value-of select="$labels/q-1-2"/></th>
            </tr>
            <tr>
                <td>
                    <table class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-1-2-1"/></th>
                            <th><xsl:value-of select="$labels/q-1-2-3"/></th>
                            <th><xsl:value-of select="$labels/address"/></th>
                            <th><xsl:value-of select="$labels/location"/></th>
                            <th style="width:40%;"><xsl:value-of select="$labels/q-1-2-4"/></th>
                        </tr>
                    <xsl:for-each select="./q-1-2/q-1-2-table/q-1-2-row">
                        <tr>
                            <td class="rowHeight"><xsl:value-of select="./q-1-2-a"/></td>
                            <td class="rowHeight"><xsl:value-of select="./q-1-2-c"/></td>
                            <td>
                                <table class="noMargin">
                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-street"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-street"/></td>
                                    </tr>
                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-town"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-town"/></td>
                                    </tr>

                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-postalcode"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-postalcode"/></td>
                                    </tr>
                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-country"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-country"/></td>
                                    </tr>
                                </table>
                            </td>
                            <td>
                                <table class="noMargin">
                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-latitude"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-latitude"/></td>
                                    </tr>
                                    <tr>
                                        <th><xsl:value-of select="$labels/q-1-2-longitude"/></th>
                                    </tr>
                                    <tr>
                                        <td class="rowHeight"><xsl:value-of select="./q-1-2-longitude"/></td>
                                    </tr>
                                </table>
                            </td>
                            <td class="rowHeight" ><xsl:value-of select="./q-1-2-d"/></td>
                        </tr>
                    </xsl:for-each>
                    </table>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-2">
       <table>
           <tr>
               <th><h3><xsl:value-of select="$labels/q-2"/></h3></th>
           </tr>
           <tr>
               <td>
                   <table class="noMargin">
                       <tr>
                           <th><xsl:value-of select="$labels/q-2-1-1"/></th>
                           <th><xsl:value-of select="$labels/q-2-1-2"/></th>
                           <th><xsl:value-of select="$labels/q-2-1-3"/></th>
                       </tr>

                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-2-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-2-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-2-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-3-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-3-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-3-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-4-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-4-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-4-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-5-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-5-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-5-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-6-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-6-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-6-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-7-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-7-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-7-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-8-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-8-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-8-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-9-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-9-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-9-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-10-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-10-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-10-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-11-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-11-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-11-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-12-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-12-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-12-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-13-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-13-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-13-b"/>
                               </td>
                           </tr>
                           <tr>
                               <th>
                                   <xsl:value-of select="$labels/q-2-14-1"/>
                               </th>
                               <td>
                                   <xsl:value-of select="./q-2-14-a"/>
                               </td>
                               <td>
                                   <xsl:value-of select="./q-2-14-b"/>
                               </td>
                           </tr>

                   </table>
               </td>
           </tr>
       </table>
    </xsl:template>

    <xsl:template match="q-3">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-3"/></h3></th>
                <td><xsl:value-of select="./q-3-1"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-3-1-yes"/></th>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-3-1-a"/></th>
            </tr>
            <tr>
                <td colspan="2"><xsl:value-of select="./q-3-1-a"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-3-1-no"/></th>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-3-1-b"/></th>
            </tr>
            <tr>
                <td colspan="2"><xsl:value-of select="./q-3-1-b"/></td>
            </tr>
        </table>

    <!--#################  q-4 ################# -->

        <table >
                <tr>
                    <td >
                <xsl:for-each select="../q-1/q-1-2/q-1-2-table/*">
                <xsl:choose>
                    <xsl:when test="(./q-1-2-c = 'Co-incineration in cement kiln' or ./q-1-2-c = 'Co-incineration in combustion plant' or ./q-1-2-c = 'Co-incineration in other industrial facilities') and position() = 1">
                        <table  class="noMargin">
                            <tr>
                                <th colspan="4"><h3><xsl:value-of select="$labels/q-4"/></h3></th>
                            </tr>
                        </table>
                    </xsl:when>
                </xsl:choose>
                <xsl:choose>

                    <xsl:when test="./q-1-2-c = 'Co-incineration in cement kiln'">
                        <table class="noMargin">
                            <thead>
                                <tr>
                                    <th colspan="4"><xsl:value-of select="concat(./q-1-2-a,' (', ./q-1-2-c,') ')"/></th>
                                </tr>
                                <tr>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-1']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-2']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-4']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-6']"/></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-2-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-2-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-2-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-2-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-3-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-3-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-3-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-3-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-4-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-4-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-4-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-4-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-5-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-5-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-5-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-5-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-6-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-6-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-6-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-6-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-7-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-7-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-7-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-7-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-8-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-8-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-8-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-8-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-9-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-9-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-9-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-9-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-13-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-10-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-10-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-10-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-10-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-11-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-11-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-11-r']"/></td>
                                </tr>
                            </tbody>
                        </table>
                    </xsl:when>


                    <xsl:when test="./q-1-2-c = 'Co-incineration in combustion plant'">
                        <table  class="noMargin">
                            <thead>
                                <tr>
                                    <th colspan="4"><xsl:value-of select="concat(./q-1-2-a,' (', ./q-1-2-c,') ')"/></th>
                                </tr>
                                <tr>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-1']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-2']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-4']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-6']"/></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-12-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-12-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-12-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-12-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-13-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-13-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-13-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-13-r']"/></td>
                                </tr>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-14-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-14-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-14-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-14-r']"/></td>
                                </tr>
                            </tbody>

                        </table>
                    </xsl:when>
                    <xsl:when test="./q-1-2-c = 'Co-incineration in other industrial facilities'">
                        <table  class="noMargin">
                            <thead>
                                <tr>
                                    <th colspan="4"><xsl:value-of select="concat(./q-1-2-a,' (', ./q-1-2-c,') ')"/></th>
                                </tr>
                                <tr>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-1']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-2']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-4']"/></th>
                                    <th><xsl:value-of select="$labels/*[local-name()= 'q-4-1-6']"/></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td><xsl:value-of select="$labels/*[local-name()= 'q-4-16-1']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-16-a']"/> </td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-16-c']"/></td>
                                    <td><xsl:value-of select="./q-4/*[local-name() = 'q-4-16-r']"/></td>
                                </tr>
                            </tbody>
                        </table>
                    </xsl:when>
                    <xsl:otherwise></xsl:otherwise>
                </xsl:choose>


            </xsl:for-each>

                    </td>
                </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-5">
        <table>
            <tr>
                <th ><h3><xsl:value-of select="$labels/q-5"/></h3></th>
            </tr>
            <tr>
                <th ><xsl:value-of select="$labels/q-5-a"/></th>
            </tr>
            <tr>
                <td><xsl:value-of select="./q-5-1"/></td>
            </tr>
            <tr>
                <th ><xsl:value-of select="$labels/q-5-b"/></th>
            </tr>
            <tr>
                <td><xsl:value-of select="./q-5-2"/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-6">
        <table>
            <tr>
                <th>
                    <h3><xsl:value-of select="$labels/q-6"/></h3>
                </th>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-6-1"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-6-1"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-6-2"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-6-2"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-6-3"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-6-3"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-6-4"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-6-4"/>
                </td>
            </tr>
        </table>
    </xsl:template>


    <xsl:template match="q-7">
        <table>
            <tr>
                <th>
                    <h3><xsl:value-of select="$labels/q-7"/></h3>
                </th>
            </tr>

            <tr>
                <td>
                    <xsl:value-of select="./q-7-1"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-7-1-none"/>
                </th>
            </tr>
            <tr>
                <td>
                    <table class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-7-1-th-wastetype"/></th>
                            <th><xsl:value-of select="$labels/q-7-1-th-reasoning"/></th>
                        </tr>
                        <xsl:for-each select="./q-7-1-table/q-7-1-row">
                            <tr>
                                <td>
                                    <xsl:value-of select="./q-7-1-wastetype"/>
                                </td>
                                <td>
                                    <xsl:value-of select="./q-7-1-reasoning"/>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </table>

                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-8">
        <table>
            <tr>
                <th>
                    <h3><xsl:value-of select="$labels/q-8"/></h3>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-8-1"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-8-1-a"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:value-of select="./q-8-1-a"/>
                </td>
            </tr>
            <tr>
                <th>
                    <xsl:value-of select="$labels/q-8-2"/>
                </th>
            </tr>
            <tr>
                <td>
                    <xsl:for-each select="./q-8-2-table/q-8-2-row">
                    <table class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-8-2-thId"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thNewExisting"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thType"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thResidues"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thCoCons"/></th>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="./q-8-2-Id"/></td>
                            <td>
                               <xsl:value-of select="./q-8-2-NewExisting"/>
                            </td>
                            <td>
                                <table class="noMargin">

                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-MunicipalWaste = 'true' or ./q-8-2-Type-Incin-NonHazardous = 'true' or ./q-8-2-Type-Incin-NonHazardous = 'true'
                                        or ./q-8-2-Type-Incin-Hazardous = 'true' or ./q-8-2-Type-Incin-Tallow = 'true' or ./q-8-2-Type-Incin-Wood = 'true' or ./q-8-2-Type-Incin-Sewage = 'true'
                                        or ./q-8-2-Type-Incin-Other = 'true'">
                                            <tr>
                                                <th><xsl:value-of select="$labels/q-8-2-Type-Incin-h2"/></th>
                                            </tr>
                                        </xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-MunicipalWaste = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-MunicipalWaste"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-NonHazardous = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-NonHazardous"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-Hazardous = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-Hazardous"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-Tallow = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-Tallow"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-Wood = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Cem-Wood-Category"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-Sewage = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-Sewage"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Incin-Other = 'true'"><tr><td><xsl:value-of select="$labels/q-8-2-Type-Incin-Other"/></td></tr></xsl:when>
                                    </xsl:choose>

                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Oils = 'true' or ./q-8-2-Type-Cement-Solvents = 'true' or ./q-8-2-Type-Cement-Filtercakes = 'true' or
                                        ./q-8-2-Type-Cement-Wood = 'true' or ./q-8-2-Type-Cement-Plastics = 'true' or ./q-8-2-Type-Cement-Textiles = 'true' or
                                        ./q-8-2-Type-Cement-RDF = 'true' or ./q-8-2-Type-Cement-Fluff = 'true' or ./q-8-2-Type-Cement-Other = 'true'">
                                            <tr>
                                                <th><xsl:value-of select="$labels/q-8-2-Type-Cement-H2"/></th>
                                            </tr>
                                        </xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Oils = 'true'"><tr><td><xsl:value-of select="$labels/q-4-2-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Solvents = 'true'"><tr><td><xsl:value-of select="$labels/q-4-3-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Filtercakes = 'true'"><tr><td><xsl:value-of select="$labels/q-4-4-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Wood = 'true'"><tr><td><xsl:value-of select="$labels/q-4-5-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Plastics = 'true'"><tr><td><xsl:value-of select="$labels/q-4-6-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Textiles = 'true'"><tr><td><xsl:value-of select="$labels/q-4-7-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-RDF = 'true'"><tr><td><xsl:value-of select="$labels/q-4-8-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Fluff = 'true'"><tr><td><xsl:value-of select="$labels/q-4-9-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Cement-Other = 'true'"><tr><td><xsl:value-of select="$labels/q-4-10-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Combus-Wood = 'true' or ./q-8-2-Type-Combus-Sludge = 'true' or ./q-8-2-Type-Combus-Other = 'true'">
                                            <tr>
                                                <th><xsl:value-of select="$labels/q-8-2-Type-CombPlant"/></th>
                                            </tr>
                                        </xsl:when>
                                    </xsl:choose>

                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Combus-Wood = 'true'"><tr><td><xsl:value-of select="$labels/q-4-12-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Combus-Sludge = 'true'"><tr><td><xsl:value-of select="$labels/q-4-13-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Combus-Other = 'true'"><tr><td><xsl:value-of select="$labels/q-4-14-1"/></td></tr></xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Other-Other = 'true'">
                                            <tr>
                                                <th><xsl:value-of select="$labels/q-8-2-Type-Other-h2"/></th>
                                            </tr>
                                        </xsl:when>
                                    </xsl:choose>
                                    <xsl:choose>
                                        <xsl:when test="./q-8-2-Type-Other-Other = 'true'"><tr><td><xsl:value-of select="$labels/q-4-14-1"/></td></tr></xsl:when>
                                    </xsl:choose>

                                </table>
                            </td>
                            <td>
                                <xsl:value-of select="./q-8-2-thResidues"/>
                            </td>
                            <td>
                                <xsl:value-of select="./q-8-2-CoCons"/>
                            </td>
                        </tr>
                    </table>
                    <table class="noMargin">
                        <tr>
                            <th colspan="5"><xsl:value-of select="$labels/q-8-2-thLimit"/></th>
                            <th></th>
                        </tr>
                        <tr>
                            <th><xsl:value-of select="$labels/q-8-2-thParameter"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thLimitVal"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thUnit"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thAveraging"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thO2"/></th>
                            <th><xsl:value-of select="$labels/q-8-2-thRequirement"/></th>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="./q-8-2-Parameter"/></td>
                            <td><xsl:value-of select="./q-8-2-LimitVal"/></td>
                            <td><xsl:value-of select="./q-8-2-Unit"/></td>
                            <td><xsl:value-of select="./q-8-2-Averaging"/></td>
                            <td><xsl:value-of select="./q-8-2-O2"/></td>
                            <td><xsl:value-of select="./q-8-2-Requirement"/></td>
                        </tr>
                        <tr>
                            <td colspan="6"><xsl:value-of select="./q-8-2-Remarks"/></td>
                        </tr>
                    </table>
                    </xsl:for-each>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-11">
        <table>
            <tr>
                <th><xsl:value-of select="$labels/q-11"/></th>
                <td><xsl:value-of select="./q-11-1"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-11-2"/></th>
            </tr>
            <tr>
                <td colspan="2"><xsl:value-of select="./q-11-2"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-11-3"/></th>
            </tr>
            <tr>
                <td colspan="2">
                    <xsl:for-each select="./q-11-3-table/q-11-3-row">
                        <table class="noMargin">
                            <tr>
                                <th><xsl:value-of select="$labels/q-11-3-1"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-2"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-WasteType"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-3"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-4"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-OtherConditions"/></th>
                            </tr>
                            <tr>
                                <td><xsl:value-of select="./q-11-3-Capacity"/></td>
                                <td><xsl:value-of select="./q-11-3-NewExisting"/></td>
                                <td><xsl:value-of select="./q-11-3-WasteType"/></td>
                                <td><xsl:value-of select="./q-11-3-Reasoning"/></td>
                                <td><xsl:value-of select="./q-11-3-Remarks"/></td>
                                <td><xsl:value-of select="./q-11-3-OtherConditions"/></td>
                            </tr>
                        </table>
                        <table class="noMargin">
                            <tr>
                                <th colspan="4"><xsl:value-of select="$labels/q-11-3-thLimit"/></th>
                            </tr>
                            <tr>
                                <th><xsl:value-of select="$labels/q-8-2-thParameter"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-thLimitVal"/></th>
                                <th><xsl:value-of select="$labels/q-8-2-thUnit"/></th>
                                <th><xsl:value-of select="$labels/q-11-3-thRelatedTimePeriod"/></th>
                            </tr>
                            <tr>
                                <td><xsl:value-of select="./q-11-3-Parameter"/></td>
                                <td><xsl:value-of select="./q-11-3-LimitVal"/></td>
                                <td><xsl:value-of select="./q-11-3-Unit"/></td>
                                <td><xsl:value-of select="./q-11-3-RelatedTimePeriod"/></td>
                            </tr>
                        </table>
                    </xsl:for-each>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-12">
        <table >
            <tr>
                <th ><h3><xsl:value-of select="$labels/q-12"/></h3></th>
                <td><xsl:value-of select="./q-12-1"/></td>
            </tr>
        </table>
        <xsl:for-each select="./q-12-2-table/q-12-2-row">
            <table class="noMargin">
                <thead>
                    <tr>
                        <th rowspan="2"><xsl:value-of select="$labels/q-12-1-1"/></th>
                        <th rowspan="2"><xsl:value-of select="$labels/q-12-1-thPlantType"/></th>
                        <th rowspan="2"><xsl:value-of select="$labels/q-12-1-2"/></th>
                        <th rowspan="2"><xsl:value-of select="$labels/q-12-2-thParameter"/></th>
                        <th colspan="4"><xsl:value-of select="$labels/q-12-1-3"/></th>
                    </tr>
                    <tr>
                        <th><xsl:value-of select="$labels/q-12-1-3-1"/></th>
                        <th><xsl:value-of select="$labels/q-12-1-3-2"/></th>
                        <th><xsl:value-of select="$labels/q-12-1-3-3"/></th>
                        <th><xsl:value-of select="$labels/q-12-1-3-4"/></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="height:1.5em;">
                            <xsl:value-of select="./q-12-2-1-Type"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-Type2"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-NewExisting"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-Parameter"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-LimitVal"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-Unit"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-Averaging"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-O2"/>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table class="noMargin">
                <thead>
                    <tr>
                        <th><xsl:value-of select="$labels/q-12-3-1"/></th>
                        <th><xsl:value-of select="$labels/q-12-3-2"/></th>
                        <th><xsl:value-of select="$labels/q-12-3-3"/></th>
                        <th><xsl:value-of select="$labels/q-12-3-4"/></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="height:1.5em;">
                            <xsl:value-of select="./q-12-2-1-ReasonLimit"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-MonitorMethod"/>
                        </td>
                        <td>
                            <xsl:value-of select="q-12-2-1-IfDiscoFrequency"/>
                        </td>
                        <td>
                            <xsl:value-of select="./q-12-2-1-Remarks"/>
                        </td>
                    </tr>
                </tbody>
            </table>
        </xsl:for-each>
    </xsl:template>
    <xsl:template match="q-13">
        <table>
            <tr>
                <th ><h3><xsl:value-of select="$labels/q-13"/></h3></th>
                <td style="width:5em;"><xsl:value-of select="./q-13-1"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-13-3"/></th>
            </tr>
            <tr>
                <td colspan="2"  style="height:1.5em;"><xsl:value-of select="./q-13-1-Remarks"/></td>
            </tr>
        </table>
        <xsl:for-each select=".">
            <table  class="noMargin">
                <thead>

                    <tr>
                        <th rowspan="2"><xsl:value-of select="$labels/q-13-4-1"/></th>
                        <th colspan="3"><xsl:value-of select="$labels/q-13-4-2"/></th>
                        <th  style="width:5em;" rowspan="2"><xsl:value-of select="$labels/q-13-4-3"/></th>

                    </tr>
                    <tr>
                        <th><xsl:value-of select="$labels/q-13-4-2-1"/></th>
                        <th><xsl:value-of select="$labels/q-13-4-2-2"/></th>
                        <th><xsl:value-of select="$labels/q-13-4-2-3"/></th>

                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-5"/></td>
                        <td><xsl:value-of select="./q-13-1-1-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-1-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-1-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-1-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-6"/></td>
                        <td><xsl:value-of select="./q-13-1-2-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-2-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-2-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-2-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-7"/></td>
                        <td><xsl:value-of select="./q-13-1-3-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-3-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-3-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-3-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-8"/></td>
                        <td><xsl:value-of select="./q-13-1-4-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-4-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-4-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-4-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-9"/></td>
                        <td><xsl:value-of select="./q-13-1-5-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-5-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-5-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-5-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-10"/></td>
                        <td><xsl:value-of select="./q-13-1-6-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-6-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-6-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-6-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-11"/></td>
                        <td><xsl:value-of select="./q-13-1-7-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-7-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-7-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-7-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-12"/></td>
                        <td><xsl:value-of select="./q-13-1-8-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-8-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-8-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-8-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-13"/></td>
                        <td><xsl:value-of select="./q-13-1-9-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-9-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-9-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-9-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-14"/></td>
                        <td><xsl:value-of select="./q-13-1-10-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-10-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-10-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-10-Reasoning"/></td>
                    </tr>
                    <tr>
                        <td><xsl:value-of select="$labels/q-13-15"/></td>
                        <td><xsl:value-of select="./q-13-1-11-LimitValue"/></td>
                        <td><xsl:value-of select="./q-13-1-11-Unit"/></td>
                        <td><xsl:value-of select="./q-13-1-11-Averaging"/></td>
                        <td><xsl:value-of select="./q-13-1-11-Reasoning"/></td>
                    </tr>
                </tbody>
            </table>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="q-14">
    <table>
        <tr>
            <th ><h3><xsl:value-of select="$labels/q-14"/></h3></th>
            <td style="width:5em;"><xsl:value-of select="./q-14-yesno"/></td>
        </tr>
        <tr>
            <th colspan="2"><xsl:value-of select="$labels/q-14-3"/></th>
        </tr>
        <tr>
            <td colspan="2" style="height:1.5em;"><xsl:value-of select="./q-14-r"/></td>
        </tr>
    </table>
    <xsl:for-each select="./q-14-IfYes-table/q-14-IfYes-row">
        <table  class="noMargin">
            <thead>
                <tr>
                    <th rowspan="2"><xsl:value-of select="$labels/q-14-4-1"/></th>
                    <th colspan="2"><xsl:value-of select="$labels/q-14-4-2"/></th>
                    <th colspan="3"><xsl:value-of select="$labels/q-14-4-3"/></th>
                </tr>
                <tr>
                    <th>
                        <xsl:value-of select="$labels/q-14-4-2-1"/>
                    </th>
                    <th>
                        <xsl:value-of select="$labels/q-14-4-2-2"/>
                    </th>
                    <th>
                        <xsl:value-of select="$labels/q-14-4-3-1"/>
                    </th>
                    <th>
                        <xsl:value-of select="$labels/q-14-4-3-2"/>
                    </th>
                    <th>
                        <xsl:value-of select="$labels/q-14-4-3-3"/>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="height:1.5em;">
                        <xsl:value-of select="./q-14-1-IfYes-Pollutant"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-Type"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-NewExisting"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-LimitValue"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-Unit"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-Averaging"/>
                    </td>
                </tr>

            </tbody>
        </table>
        <table  class="noMargin">
            <thead>
                <tr>
                    <th ><xsl:value-of select="$labels/q-14-6-1"/></th>
                    <th ><xsl:value-of select="$labels/q-14-6-2"/></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="height:1.5em;">
                        <xsl:value-of select="./q-14-1-IfYes-Reasoning"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q-14-1-IfYes-Remarks"/>
                    </td>
                </tr>
            </tbody>
        </table>
    </xsl:for-each>
    </xsl:template>
    <xsl:template match="q-15">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-15"/></h3></th>
            </tr>
            <tr>
                <td>
                    <table  class="noMargin">
                        <xsl:choose>
                            <xsl:when test="string-length(./q-15-pH) &gt; 0"><tr><td style="height:1.5em;"><xsl:value-of select="$labels/q-15-1-1"/></td></tr> </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-15-Temperature) &gt; 0"><tr><td style="height:1.5em;"><xsl:value-of select="$labels/q-15-1-2"/></td></tr> </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-15-Flow) &gt; 0"><tr><td style="height:1.5em;"><xsl:value-of select="$labels/q-15-1-3"/></td></tr> </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-15-Other ) &gt; 0"><tr><td style="height:1.5em;"><xsl:value-of select="$labels/q-15-1-4"/></td></tr> </xsl:when>
                        </xsl:choose>
                    </table>
                </td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-15-2"/></th>

            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-15-Remarks"/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-16">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-16"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"> <xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-17">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-17"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"> <xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-18">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-18"/></h3></th>
            </tr>
            <tr>
                <td  style="height:1.5em;"> <xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-19">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-19"/></h3></th>
            </tr>
            <tr>
                <xsl:call-template name="getValueTd"><xsl:with-param name="elem" select="./q-19-yesno"/></xsl:call-template>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-19-2"/></th>
            </tr>
            <tr>
                <td  colspan="2" style="height:1.5em;"><xsl:value-of select="./q-19-Remarks"/></td>
            </tr>
            <tr>
                <th colspan="2"><xsl:value-of select="$labels/q-19-3"/></th>
            </tr>
            <tr>
                <td colspan="2">
                    <table  class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-19-4-1"/></th>
                            <th><xsl:value-of select="$labels/q-19-4-2"/></th>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-4-3"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-1-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-1-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td colspan="2"><xsl:value-of select="$labels/q-19-4-4"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-5"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-3-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-3-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-6"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-4-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-4-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-7"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-5-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-5-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-8"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-6-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-6-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-9"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-7-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-7-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-10"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-8-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-8-SpecifyPollutant"/></td>
                        </tr>
                        <tr>
                            <td><xsl:value-of select="$labels/q-19-11"/> : <xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-19-IfNo-1-Reason"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-19-IfNo-9-SpecifyPollutant"/></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-20">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-20"/></h3></th>
            </tr>
            <tr>
                <td  style="height:1.5em;"> <xsl:value-of select="./q-20-yesno"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-20-2"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-20-Remarks"/></td>
            </tr>
            <tr>
                <td>
                <xsl:for-each select="./q-20-IfNo-table/q-20-IfNo-row">
                    <table  class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-20-4-1"/></th>
                            <th><xsl:value-of select="$labels/q-20-4-2"/></th>
                        </tr>
                        <tr>
                            <td  style="height:1.5em;"><xsl:call-template name="getBoolean"><xsl:with-param name="elem" select="./q-20-IfNo-1"/></xsl:call-template></td>
                            <td><xsl:value-of select="./q-20-IfNo-1-SpecifyPollutant"/></td>
                        </tr>
                    </table>
                </xsl:for-each>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-21">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-21"/></h3></th>
            </tr>

            <tr>
                <th><xsl:value-of select="$labels/q-21-1"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-21-1"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-21-2"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-21-2"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-21-3"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-21-3"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-21-4"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-21-4"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-21-5"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-21-5"/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-22">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-22"/></h3></th>
            </tr>

            <tr>
                <th><xsl:value-of select="$labels/q-22-1"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-22-1"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-22-2"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-22-2"/></td>
            </tr>
            <tr>
                <td>
                    <table  class="noMargin">
                        <tr>
                            <td style="height:1.5em;">
                                <xsl:choose>
                                    <xsl:when test="string-length(./q-22-2-water-Regime) &gt; 0"> <xsl:value-of select="./q-22-2-water-Regime"/></xsl:when>
                                    <xsl:when test="string-length(./q-22-2-air-Regime) &gt; 0"><xsl:value-of select="./q-22-2-air-Regime"/></xsl:when>
                                </xsl:choose>
                            </td>
                        </tr>
                        <tr>
                            <th colspan="2">
                                <xsl:value-of select="$labels/q-22-2-3"/>
                            </th>
                        </tr>
                        <tr>
                            <td style="height:1.5em;">
                                <xsl:choose>
                                    <xsl:when test="string-length(./q-22-2-water-Regime) &gt; 0"> <xsl:value-of select="./q-22-2-water-Regime-Specify"/></xsl:when>
                                    <xsl:when test="string-length(./q-22-2-air-Regime) &gt; 0"><xsl:value-of select="./q-22-2-air-Regime-Specify"/></xsl:when>
                                </xsl:choose>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-23">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-23"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-23-1"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-23-1"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-23-1-Ref"/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-24">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-24"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-25">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-25"/></h3></th>
            </tr>
            <tr>
                <td>
                    <table  class="noMargin">
                        <tr>
                            <th><xsl:value-of select="$labels/q-25-2-1"/></th>
                            <th><xsl:value-of select="$labels/q-25-2-2"/></th>
                            <th><xsl:value-of select="$labels/q-25-2-3"/></th>
                            <th><xsl:value-of select="$labels/q-25-2-4"/></th>
                            <th><xsl:value-of select="$labels/q-25-2-5"/></th>
                        </tr>
                    <xsl:for-each select="./q-25-table/q-25-row">

                            <tr>
                                <td style="height:1.5em;"><xsl:value-of select="./q-25-PermitType"/></td>
                                <td>
                                    <table class="noMargin">
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailability-atLocalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atLocalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailability-atRegionalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atRegionalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailability-atNationalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atNationalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailability-atSeveralPublicLocations) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atSeveralPublicLocations"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailability-internet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-internet"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                           <xsl:when test="string-length(./q-25-PublicAvailability-notPubliclyAvailableYet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-notPubliclyAvailableYet"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                           <xsl:when test="string-length(./q-25-PublicAvailability-other) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-7"/></td></tr></xsl:when>
                                        </xsl:choose>
                                    </table>
                                </td>
                                <td><xsl:value-of select="./q-25-PublicCommentPeriod"/></td><!--  style="height:1.5em;" -->
                                <td>
                                    <table class="noMargin">
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-atLocalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atLocalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-atRegionalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atRegionalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-atNationalAuthorityOffice) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atNationalAuthorityOffice"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-atSeveralPublicLocations) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-atSeveralPublicLocations"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-internet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-internet"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-notPubliclyAvailableYet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-25-PublicAvailability-notPubliclyAvailableYet"/></td></tr></xsl:when>
                                        </xsl:choose>
                                        <xsl:choose>
                                            <xsl:when test="string-length(./q-25-PublicAvailabilityFinal-other) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-7"/></td></tr></xsl:when>
                                        </xsl:choose>
                                    </table>
                                </td>
                                <td>
                                    <xsl:value-of select="./q-25-PermitRemarks"/>
                                </td>
                            </tr>


                    </xsl:for-each>
                    </table>
                </td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-26">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-26"/></h3></th>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-1"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-1"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-3"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-1-Remarks"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-4"/></th>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-5"/></th>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-3"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-1-IfYes-Reason"/></td>
            </tr>
        </table>
        <table class="noMargin">
            <tr>
                <th><xsl:value-of select="$labels/q-26-6"/><xsl:value-of select="$labels/q-26-7"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-2-IfNo"/></td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-9"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-2-IfNo-Remarks"/></td>
            </tr>

            <tr>
                <th><xsl:value-of select="$labels/q-26-6"/></th>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-26-10"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-26-2-IfNo-Remarks"/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-27">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-27"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-28">
        <table>
        <tr>
            <th><h3><xsl:value-of select="$labels/q-28"/></h3></th>
        </tr>
        <tr>
            <th><xsl:value-of select="$labels/q-28-1"/></th>
        </tr>
        <tr>
            <td style="height:1.5em;">
                <table  class="noMargin">
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-AccountProcess) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-1"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-EmissionsAir) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-2"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-EmissionsWater) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-3"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-Capacity) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-4"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-TypeInstallation) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-5"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-TypeWaste) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-6"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-28-1-Other ) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-2-7"/></td></tr></xsl:when>
                    </xsl:choose>
                </table>
            </td>
        </tr>
        <tr>
            <th><xsl:value-of select="$labels/q-28-3"/></th>
        </tr>
        <tr>
            <td style="height:1.5em;"><xsl:value-of select="./q-28-1-Remarks"/></td>
        </tr>
    </table>
        <table>
            <tr>
                <th><xsl:value-of select="$labels/q-28-4"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;">
                    <table  class="noMargin">
                        <xsl:choose>
                            <xsl:when test="string-length(./q-28-2-AllReportsInternet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-5-1"/></td></tr></xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-28-2-AllReportsAuthorityRequest) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-5-2"/></td></tr></xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-28-2-AllReportsInstallationRequest) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-5-3"/></td></tr></xsl:when>
                        </xsl:choose>
                        <xsl:choose>
                            <xsl:when test="string-length(./q-28-2-Other) &gt; 0"><tr><td><xsl:value-of select="$labels/q-28-5-4"/></td></tr></xsl:when>
                        </xsl:choose>
                    </table>
                </td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-28-6"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-28-2-Remarks"/></td>
            </tr>
        </table>
    </xsl:template>
    <xsl:template match="q-29">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-29"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;">
                    <xsl:choose>
                        <xsl:when test="string-length(./q-29-PublishedCA) &gt; 0"><tr><td><xsl:value-of select="$labels/q-29-1-1"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-29-Internet) &gt; 0"><tr><td><xsl:value-of select="$labels/q-29-1-2"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-29-NoList) &gt; 0"><tr><td><xsl:value-of select="$labels/q-29-1-3"/></td></tr></xsl:when>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="string-length(./q-29-Other) &gt; 0"><tr><td><xsl:value-of select="$labels/q-29-1-4"/></td></tr></xsl:when>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <th><xsl:value-of select="$labels/q-29-2"/></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="./q-29-Remarks"/></td>
            </tr>
        </table>
    </xsl:template>
    <xsl:template match="q-30">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-30"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="."/></td>
            </tr>
        </table>
    </xsl:template>
    <xsl:template match="q-31">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-31"/></h3></th>
            </tr>
            <tr>
                <table  class="noMargin">
                    <tr>
                        <th><xsl:value-of select="$labels/q-31-1-1"/></th>
                        <th><xsl:value-of select="$labels/q-31-1-2"/></th>
                        <th><xsl:value-of select="$labels/q-31-1-3"/></th>
                    </tr>
                    <xsl:for-each select="./q-31-table/q-31-row">
                        <tr>
                            <td  style="height:1.5em;"><xsl:value-of select="./q-31-MaxExceedenceEmissionLimitValues"/></td>
                            <td><xsl:value-of select="./q-31-MaxDuration"/></td>
                            <td><xsl:value-of select="./q-31-ItemRemarks"/></td>
                        </tr>
                    </xsl:for-each>
                </table>
            </tr>
        </table>
    </xsl:template>

    <xsl:template match="q-32">
        <table>
            <tr>
                <th><h3><xsl:value-of select="$labels/q-32"/></h3></th>
            </tr>
            <tr>
                <td style="height:1.5em;"><xsl:value-of select="."/></td>
            </tr>
        </table>
    </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="$labelValue = 'true'">
                        Yes
                    </xsl:when>
                    <xsl:when test="$labelValue = 'false'">
                        No
                    </xsl:when>
                </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of disable-output-escaping="yes" select="$labelName"/>
            </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="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="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>

    <!-- 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="getBoolean">
        <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>

        <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="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="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>
    </xsl:template>
</xsl:stylesheet>