View stylesheet

XML schemas http://dd.eionet.europa.eu/schemas/MSFD13/MSFD13_1p0.xsd
Output type HTML
Description HTML
XSL file MSFD13_1p0.xslt (Last modified: 20 Oct 2015 12:51 )
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:dc="http://purl.org/dc/elements/1.1/" 
                xmlns:fn="http://www.w3.org/2005/xpath-functions" 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                version="1.0" 
                >
  <xsl:output version="4.0" 
              method="html" 
              indent="yes" 
              encoding="UTF-8" 
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" 
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>


  <xsl:variable name="labels" select="document('http://converterstest.eionet.europa.eu/queries/msfd13-labels-en.xml')/labels"/>
  <xsl:variable name="codelists" select="document('http://converterstest.eionet.europa.eu/queries/msfd13-codelists.xml')/codelists"/>
  <!--
  <xsl:variable name="labels" select="document('file://C:/svn/MSFD/Tools/xml/msfd13-labels-en.xml')/labels"/>
  <xsl:variable name="codelists" select="document('file://C:/svn/MSFD/Tools/xml/codelists/msfd13-codelists.xml')/codelists"/>
  -->

  <xsl:param name="SV_OutputFormat" select="'HTML'"/>

  
  <xsl:variable name="XMLA" select="/"/>

  <!--for comparison tool--> 
  <xsl:variable name="fileA" select="//FileA/FullPath"/>
  <xsl:variable name="titleA" select="//FileA/Title"/>
  <xsl:variable name="fileADate" select="//FileA/Date"/>
  <!--<xsl:variable name="XMLA" select="document($fileA)"/>-->

  <xsl:variable name="fileB" select="//FileB/FullPath"/>
  <xsl:variable name="titleB" select="//FileB/Title"/>
  <xsl:variable name="fileBDate" select="//FileB/Date"/>
  <xsl:variable name="XMLB" select="document($fileB)"/>


  <!--<xsl:variable name="XMLA">
    <xsl:choose>
      <xsl:when test="($fileA)">
        <xsl:value-of select="document($fileA)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="/"/>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>-->

  
  <!--<xsl:import-schema schema-location="http://dd.eionet.europa.eu/schemas/MSFD11Mon/MSFD11Monsub_1p0.xsd"/> -->
	<xsl:template match="/">
    <xsl:call-template name="Root">
    </xsl:call-template>
	</xsl:template>
	
	<xsl:template name="Root">
    <html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Reporting requirement on Programmes of Measures under MSFD Article 13</title>
<style type="text/css">
  body {font-family: Verdana, Arial, Helvetica,sans-serif, "MS sans serif";background: #fff; color: #000; font-size: 8pt;}
  fieldset {margin-bottom: 1em; }	
  fieldset legend { font-weight: bold; } 
	/* IE - Fix some weirdness with group labels/legends */ 
	legend span { display: block !important; white-space:normal !important; width: 100%; } 
  /* Fix for odd br in label in IE only for other langs */ 
  label br { display: none; } 
	.label { width: auto !important; white-space: normal !important; } 
	.info { padding: 0.5em; display: block;} 
  .ta { display: block; border:1px solid #bcd884; padding: 0.5em; color: rgb(85, 96, 63); font-size: 8pt; font-weight: bold;} 
  .qa { display: block; width : 98%; border:1px solid #fff; } 
  
  .qa-table {width : 100%;}
  .qa-table td, .qa-table th{ 
  padding-left: 0.5em;
  padding-right: 0.5em;
  width: 45%
  } 
  
  .q-cell .a-cell {}
  
  .notPresent { color : blue; }
  .oneCol { width: 100%; overflow: hidden;}
  .twoCol { width: 100%; overflow: hidden; }
  .leftCol { float: left; width: 49.8%; overflow:hidden;}
  .rightCol { float: right; width: 49.8%; overflow:hidden;}
  /*.rightCol { float: left; margin-left: 50%; width: 100%; overflow:hidden;}*/
  #container {
  width: 100%;
  min-width: 600px;
  position: relative;
  margin: 0px auto;
  /*  max-width: 80em;*/
  background-color: #fff;
  color: #333;
  }

</style>
</head>
    <body class="fullscreen">
      <div id="container">
        <form name="chibaform" >
          <h1>
            <label class="label heading" id="C1" for="C1">
              <xsl:value-of select="$labels/title-pom" />
            </label>
          </h1>
<!-- use format-date to get rid of the time zone information -->
<h2>
Generated at: 
<xsl:value-of  select="format-date(current-date(), '[Y0001]-[M01]-[D01]')"/>
</h2>          
		  
          <!--<fieldset class="group" >
            <legend class="label">debug</legend>
              <xsl:copy-of select="/"/>
          </fieldset>-->

          <xsl:variable name="nps" select="$XMLA/POM/@xsi:noNamespaceSchemaLocation"/>
          <xsl:variable name="m" select="'MSFD13_1p0.xsd'"/>

          <!--<xsl:variable name="deflabels" select="$labels/Exceptions"/>-->

            <!--<xsl:variable name="deflabels">
            <xsl:choose>
              <xsl:when test="substring($nps, string-length($nps) - string-length($m) +1) = $m">
                <xsl:copy-of select="$labels/Measures"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:copy-of select="$labels/Exceptions"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>-->
          
          <xsl:choose>
            <xsl:when test="substring($nps, string-length($nps) - string-length($m) +1) = $m">
              <!--<xsl:call-template name="Single-POM"/>-->
                  <xsl:choose>
                    <xsl:when test="($XMLB)">
                      <xsl:call-template name="Compare-POM">
                        <xsl:with-param name="deflabels" select="$labels/Measures"/>
                      </xsl:call-template>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:call-template name="Single-POM">
                        <xsl:with-param name="deflabels" select="$labels/Measures"/>
                      </xsl:call-template>
                    </xsl:otherwise>
                  </xsl:choose>

            </xsl:when>
            <xsl:otherwise>

              <xsl:choose>
                <xsl:when test="($XMLB)">
                  <xsl:call-template name="Compare-POM">
                    <xsl:with-param name="deflabels" select="$labels/Exceptions"/>
                  </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:call-template name="Single-POM">
                    <xsl:with-param name="deflabels" select="$labels/Exceptions"/>
                  </xsl:call-template>
                </xsl:otherwise>
              </xsl:choose>

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

        </form>
      </div>
    </body>
  </html>
</xsl:template>

  
  <xsl:template name="Single-POM">
    <xsl:param name="deflabels" />
    <div class="oneCol">
        <xsl:apply-templates select="$XMLA/POM" mode="Index"/>
    </div>

    <h2>
      <a id="info">
        <xsl:value-of select="$labels/title-info" />
      </a>
    </h2>
    <!--Reporter-->
    <div class="oneCol">
        <xsl:apply-templates select="$XMLA/POM" mode="Reporter"/>
    </div>
    <!--SpatialCoverage-->
    <div class="oneCol">
        <xsl:apply-templates select="$XMLA/POM" mode="SpatialCoverage"/>
    </div>

    <!--FurtherInformation-->
    <div class="oneCol">
      <xsl:apply-templates select="$XMLA/POM/FurtherInformation">
        <xsl:with-param name="deflabels" select="$deflabels"/>
      </xsl:apply-templates>
    </div>

    <xsl:for-each select="$XMLA/POM/Measures">
      <div class="oneCol">
        <xsl:call-template name="SingleReport">
          <xsl:with-param name="rep" select="."/>
          <xsl:with-param name="replabels" select="$labels/Measures"/>
        </xsl:call-template>
        <!--<xsl:apply-templates select="." mode="repA"/>-->
      </div>
    </xsl:for-each>

    <xsl:for-each select="$XMLA/POM/Exceptions">
      <div class="oneCol">
        <!--<xsl:call-template name="Exceptions_single">-->
        <xsl:call-template name="SingleReport">
          <xsl:with-param name="rep" select="."/>
          <xsl:with-param name="replabels" select="$labels/Exceptions"/>
        </xsl:call-template>
        <!--<xsl:apply-templates select="." mode="repA"/>-->
      </div>
    </xsl:for-each>
  
  </xsl:template>


  <xsl:template name="Compare-POM">
    <xsl:param name="deflabels" />

    <div class="twoCol">
      <div class="leftCol">
        <h2>
          File: <xsl:value-of select="$titleA"/>
        </h2>
        <p>
          File date: <xsl:value-of select="$fileADate"/>
        </p>
        <p>This column shows the entire report for the latest submission. If there are empty spaces in this column it is because the content has been removed.</p>
      </div>
      <xsl:if test="(not($titleA = $titleB) or not($fileADate = $fileBDate))">
        <div class="rightCol">
          <h2>
            File: <xsl:value-of select="$titleB"/>
          </h2>
          <p>
            File date: <xsl:value-of select="$fileBDate"/>
          </p>
          <p>This column represents the old version of the submission. Only sections that have been changed are listed.</p>
        </div>
      </xsl:if>
    </div>
    <br/>


    <div class="twoCol">
      <div class="leftCol">
        <xsl:apply-templates select="$XMLA/POM" mode="Index"/>
      </div>
    </div>

    <h2>
      <a id="info">
        <xsl:value-of select="$labels/title-info" />
      </a>
    </h2>
    <!--Reporter-->
    <div class="twoCol">
      <div class="leftCol">
        <xsl:apply-templates select="$XMLA/POM" mode="Reporter"/>
      </div>
      <xsl:if test="(not($XMLA/POM/@ReporterName = $XMLB/POM/@ReporterName)) or (not($XMLA/POM/@ReportingDate = $XMLB/POM/@ReportingDate))">
        <div class="rightCol">
          <xsl:apply-templates select="$XMLB/POM" mode="Reporter"/>
        </div>
      </xsl:if>
    </div>
    <!--SpatialCoverage-->
    <div class="twoCol">
      <div class="leftCol">
        <xsl:apply-templates select="$XMLA/POM" mode="SpatialCoverage"/>
      </div>
      <xsl:if test="(not($XMLA/POM/MemberState = $XMLB/POM/MemberState)) or (not($XMLA/POM/Region = $XMLB/POM/Region)) or (not($XMLA/POM/MarineUnitID = $XMLB/POM/MarineUnitID))">
        <div class="rightCol">
          <xsl:apply-templates select="$XMLB/POM" mode="SpatialCoverage"/>
        </div>
      </xsl:if>
    </div>

    <!--FurtherInformation-->
    <div class="twoCol">
      <div class="leftCol">
        <xsl:apply-templates select="$XMLA/POM/FurtherInformation">
          <xsl:with-param name="deflabels" select="$deflabels"/>
        </xsl:apply-templates>
      </div>
      <xsl:if test="not($XMLA/POM/FurtherInformation = $XMLA/POM/FurtherInformation)">
        <div class="rightCol">
  	      <xsl:apply-templates select="$XMLA/POM/FurtherInformation">
            <xsl:with-param name="deflabels" select="$deflabels"/>
          </xsl:apply-templates>
        </div>
      </xsl:if>
    </div>


    <xsl:for-each select="$XMLA/POM/Measures">
      <xsl:variable name="repID" select="UniqueCode"/>
      <xsl:call-template name="CompareReportOuter">
        <xsl:with-param name="repA" select="."/>
        <xsl:with-param name="repB" select="$XMLB/POM/Measures[UniqueCode=$repID]"/>
        <xsl:with-param name="replabels" select="$labels/Measures"/>
      </xsl:call-template>
    </xsl:for-each>
    
    <!-- Repeat for all meaures that is only i file B-->
    <xsl:for-each select="$XMLB/POM/Measures">
      <xsl:variable name="repID" select="UniqueCode"/>
      <xsl:variable name="repB" select="."/>
      <xsl:variable name="repA" select="$XMLA/POM/Measures[UniqueCode=$repID]"/>
      <!-- if not repB exists -->
      <xsl:if test="not($repA)">
        <!--The measure only in old file-->
        <div class="twoCol">
          <div class="leftCol">
            <fieldset class="group" >
              <p>
                The measure with id: <xsl:value-of select="$repID"/> has been removed.
              </p>
            </fieldset>
          </div>
          <div class="rightCol">
            <xsl:call-template name="SingleReport">
              <xsl:with-param name="rep" select="$repB"/>
              <xsl:with-param name="replabels" select="$labels/Measures"/>
            </xsl:call-template>
          </div>
        </div>
      </xsl:if>
    </xsl:for-each>
  
    <xsl:for-each select="$XMLA/POM/Exceptions">
      <xsl:variable name="repID" select="UniqueCode"/>
      <xsl:call-template name="CompareReportOuter">
        <xsl:with-param name="repA" select="."/>
        <xsl:with-param name="repB" select="$XMLB/POM/Exceptions[UniqueCode=$repID]"/>
        <xsl:with-param name="replabels" select="$labels/Exceptions"/>
      </xsl:call-template>
    </xsl:for-each>
    
    <!-- Repeat for all meaures that is only i file B-->
    <xsl:for-each select="$XMLB/POM/Exceptions">
      <xsl:variable name="repID" select="UniqueCode"/>
      <xsl:variable name="repB" select="."/>
      <xsl:variable name="repA" select="$XMLA/POM/Exceptions[UniqueCode=$repID]"/>
      <!-- if not repB exists -->
      <xsl:if test="not($repA)">
        <!--The measure only in old file-->
        <div class="twoCol">
          <div class="leftCol">
            <fieldset class="group" >
              <p>
                The Exception with id: <xsl:value-of select="$repID"/> has been removed.
              </p>
            </fieldset>
          </div>
          <div class="rightCol">
            <xsl:call-template name="SingleReport">
              <xsl:with-param name="rep" select="$repB"/>
              <xsl:with-param name="replabels" select="$labels/Measures"/>
            </xsl:call-template>
          </div>
        </div>
      </xsl:if>
    </xsl:for-each>
  
  </xsl:template>

  <!-- Reporter -->
<xsl:template match="POM" mode="Reporter">
  <fieldset class="group" >
    <legend class="label">Reporter</legend>
    <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$labels/question-reportername" /></label></td>
        <td><span class="ta" ><xsl:for-each select="@ReporterName"><xsl:value-of select="string(.)"/></xsl:for-each></span></td>
      </tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$labels/question-reportingdate" /></label></td>
        <td><span class="ta" ><xsl:for-each select="@ReportingDate"><xsl:value-of select="string(.)"/></xsl:for-each></span></td>
      </tr>
    </table>
  </fieldset>
</xsl:template>

<!--SpatialCoverage-->
<xsl:template match="POM" mode="SpatialCoverage">
  <fieldset class="group" >
    <legend class="label">
      <xsl:value-of select="$labels/title-spatialcoverage" />
    </legend>
    <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$labels/question-memberstate" /></label></td>
        <td><span class="ta">
          <xsl:for-each select="MemberState">
          <xsl:variable name="val" select="."/>
          <xsl:value-of select="."/>
          <xsl:text> - </xsl:text>
          <xsl:value-of select="$codelists/countries[normalize-space(code)=$val]/label" />
          <xsl:if test="position() != last()">
            <xsl:text>, </xsl:text>
            <br/>
          </xsl:if>
        </xsl:for-each></span></td>
      </tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$labels/question-region" /></label></td>
        <td><span class="ta"><xsl:for-each select="Region">
          <xsl:variable name="val" select="."/>
          <xsl:value-of select="."/>
          <xsl:text> - </xsl:text>
          <xsl:value-of select="$codelists/regions[normalize-space(code)=$val]/label" />
          <xsl:if test="position() != last()">
            <xsl:text>, </xsl:text>
          </xsl:if>
        </xsl:for-each></span></td>
      </tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$labels/question-marineunitid" /></label></td>
        <td><span class="ta"><xsl:for-each select="MarineUnitID">
          <xsl:apply-templates/>
        </xsl:for-each></span></td>
      </tr>
    </table>
    
  </fieldset>
</xsl:template>

<!--FurtherInformation-->
  <xsl:template match="FurtherInformation">
    <xsl:param name="deflabels" />
    <fieldset class="group" >
<legend><xsl:value-of select="$deflabels/topic-FurtherInformation" /></legend>
    <!--<label class="label info" ><xsl:value-of select="$labels/question-FurtherInformation" /></label>-->

    <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$deflabels/question-SummaryReport" /></label></td>
        <td><span class="ta">
          <xsl:for-each select="SummaryReport">
            <xsl:value-of select="."/>
            <xsl:if test="position() != last()">
              <xsl:text>, </xsl:text>
            </xsl:if>
        </xsl:for-each></span></td>
      </tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$deflabels/question-WFDReport" /></label></td>
        <td><span class="ta">
          <xsl:for-each select="WFDReport">
            <xsl:value-of select="."/>
            <xsl:if test="position() != last()">
              <xsl:text>, </xsl:text>
            </xsl:if>
        </xsl:for-each></span></td>
      </tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$deflabels/question-RSCRoofReport" /></label></td>
        <td><span class="ta">
          <xsl:for-each select="RSCRoofReport">
            <xsl:value-of select="."/>
            <xsl:if test="position() != last()">
              <xsl:text>, </xsl:text>
            </xsl:if>
        </xsl:for-each></span></td>
      </tr>
    </table>
</fieldset>
</xsl:template>
  
  <!--<xsl:template match="FurtherInformation">
<fieldset class="group" >
<legend><xsl:value-of select="$labels/topic-FurtherInformation" /></legend>
    <label class="label info" ><xsl:value-of select="$labels/question-FurtherInformation" /></label>

    <span class="label info" ><xsl:value-of select="$labels/question-SummaryReport" /></span>
    <span class="ta" >
      <xsl:for-each select="SummaryReport">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each>
  </span>

    <span class="label info" ><xsl:value-of select="$labels/question-AllMeasuresAndException" /></span>
    <span class="ta" >
      <xsl:for-each select="AllMeasuresAndException">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each>
  </span>
    <span class="label info" ><xsl:value-of select="$labels/question-WFDReport" /></span>
    <span class="ta" >
      <xsl:for-each select="WFDReport">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each>
  </span>
      <span class="label info" ><xsl:value-of select="$labels/question-RSCRoofReport" /></span>
    <span class="ta" >
      <xsl:for-each select="RSCRoofReport">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each>
  </span>
</fieldset>
</xsl:template>-->
    
  <xsl:template name="SingleReport" match="Measures | Exceptions" mode="Single">
    <xsl:param name="rep" />
    <xsl:param name="replabels" />
  <xsl:variable name="uc" select="$rep/UniqueCode"/>
  <h2>
    <a name="{generate-id($uc)}">
      <xsl:value-of select="$replabels/title-report-list" />
    </a>
  </h2>
    <xsl:apply-templates select="$rep/UniqueCode">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep/Name">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:if test="($rep/LinkToExistingPolicies)">
      <xsl:apply-templates select="$rep" mode="LinkToExistingPolicies">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:apply-templates select="$rep" mode="KTM">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep" mode="RBDCode">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep" mode="RelevantEnvironmentalTargets">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep" mode="RelevantGESDescriptors">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep" mode="RelevantFeaturesFromMSFDAnnexIII">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="$rep" mode="SpatialScopeGeographicZones">
      <xsl:with-param name="replabels" select="$replabels"/>
    </xsl:apply-templates>
  </xsl:template>


  <xsl:template name="CompareReportOuter" match="Measures | Exceptions">
    <xsl:param name="repA" />
    <xsl:param name="repB" />
    <xsl:param name="replabels" />
    <xsl:variable name="repID" select="UniqueCode"/>
      <xsl:choose>
        <xsl:when test="($repB)">
          <!--There is a matching measure-->
          <xsl:call-template name="CompareReport">
            <xsl:with-param name="repA" select="$repA"/>
            <xsl:with-param name="repB" select="$repB"/>
            <xsl:with-param name="replabels" select="$replabels"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <!--The measure is new-->
          <div class="twoCol">
            <div class="leftCol">
              <xsl:call-template name="SingleReport">
                <xsl:with-param name="rep" select="$repA"/>
                <xsl:with-param name="replabels" select="$replabels"/>
              </xsl:call-template>
              <!--<xsl:apply-templates select="." mode="repA"/>-->
            </div>
            <div class="rightCol">
              <fieldset class="group" >
                <p>
                  The <xsl:value-of select="$replabels/title-report-list"/> with id: <xsl:value-of select="$repID"/> is new.
                </p>
              </fieldset>
            </div>
          </div>
        </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
<xsl:template name="CompareReport" match="Measures | Exceptions" mode="Compare">
  <xsl:param name="repA" />
  <xsl:param name="repB" />
  <xsl:param name="replabels" />
  <xsl:variable name="uc" select="$repA/UniqueCode"/>
  <h2>
    <a name="{generate-id($uc)}">
      <xsl:value-of select="$replabels/title-report-list" />
    </a>
  </h2>
  <div class="twoCol">
    <div class="leftCol">
      <xsl:apply-templates select="$repA/UniqueCode">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/UniqueCode = $repB/UniqueCode)">
      <div class="rightCol">
        <xsl:apply-templates select="$repB/UniqueCode">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
      <xsl:apply-templates select="$repA/Name">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/Name = $repB/Name)">
      <div class="rightCol">
        <xsl:apply-templates select="$repB/Name">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <xsl:if test="($repA/LinkToExistingPolicies) or ($repB/LinkToExistingPolicies)">
  <div class="twoCol">
    <div class="leftCol">
      <xsl:apply-templates select="$repA" mode="LinkToExistingPolicies">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/LinkToExistingPolicies = $repB/LinkToExistingPolicies)">
      <div class="rightCol">
        <xsl:apply-templates select="$repB" mode="LinkToExistingPolicies">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
    </xsl:if>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="KTM">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/KTM = $repB/KTM)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="KTM">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="RBDCode">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/RBDCode = $repB/RBDCode)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="RBDCode">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="RelevantEnvironmentalTargets">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/RelevantEnvironmentalTargets = $repB/RelevantEnvironmentalTargets)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="RelevantEnvironmentalTargets">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="RelevantGESDescriptors">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/RelevantGESDescriptors = $repB/RelevantGESDescriptors)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="RelevantGESDescriptors">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="RelevantFeaturesFromMSFDAnnexIII">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/RelevantFeaturesFromMSFDAnnexIII = $repB/RelevantFeaturesFromMSFDAnnexIII)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="RelevantFeaturesFromMSFDAnnexIII">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  <div class="twoCol">
    <div class="leftCol">
	    <xsl:apply-templates select="$repA" mode="SpatialScopeGeographicZones">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
    </div>
    <xsl:if test="not($repA/SpatialScopeGeographicZones = $repB/SpatialScopeGeographicZones)">
      <div class="rightCol">
  	    <xsl:apply-templates select="$repB" mode="SpatialScopeGeographicZones">
        <xsl:with-param name="replabels" select="$replabels"/>
      </xsl:apply-templates>
      </div>
    </xsl:if>
  </div>
  
</xsl:template>
  
  
<xsl:template match="UniqueCode">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-UniqueCode" /></legend>
    <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label"><xsl:value-of select="$replabels/question-UniqueCode" /></label></td>
        <td><span class="ta"><xsl:value-of select="string(.)"/></span></td>
      </tr>
    </table>
</fieldset>
</xsl:template>

    
<xsl:template match="Name">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-Name" /></legend>
    <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label"><xsl:value-of select="$replabels/question-Name" /></label></td>
        <td><span class="ta"><xsl:value-of select="string(.)"/></span></td>
      </tr>
    </table>
</fieldset>
</xsl:template>



<xsl:template match="Measures | Exceptions" mode="KTM">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-KTM" /></legend>
      <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$replabels/question-KTM" /></label></td>
        <td><span class="ta" ><xsl:for-each select="KTM">
    <xsl:variable name="val" select="."/>
    <xsl:value-of select="$codelists/ktms[normalize-space(code)=$val]/label" />
    <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
      <br/>
    </xsl:if>
  </xsl:for-each></span></td>
      </tr>
    </table>
</fieldset>
</xsl:template>
  
<xsl:template match="Measures | Exceptions" mode="RBDCode">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-rbdcode" /></legend>
      <table class="qa-table">
      <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
      <tr>
        <td><label class="label" ><xsl:value-of select="$replabels/question-rbdcode" disable-output-escaping="yes"/></label></td>
        <td><span class="ta" ><xsl:for-each select="RBDCode">
    <xsl:value-of select="string(.)" />
    <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
      <br/>
    </xsl:if>
  </xsl:for-each></span></td>
      </tr>
    </table>
</fieldset>
</xsl:template>
  
  
<xsl:template match="Measures | Exceptions" mode="RelevantEnvironmentalTargets">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-RelevantEnvironmentalTargets" /></legend>
  <table class="qa-table">
  <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
  <tr>
    <td><label class="label" ><xsl:value-of select="$replabels/question-RelevantEnvironmentalTargets" /></label></td>
    <td><span class="ta" >
      <xsl:for-each select="RelevantEnvironmentalTargets">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each></span></td>
  </tr>
</table>
</fieldset>
</xsl:template>

<xsl:template match="Measures | Exceptions" mode="RelevantGESDescriptors">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-RelevantGESDescriptors" /></legend>
  <table class="qa-table">
  <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
  <tr>
    <td><label class="label" ><xsl:value-of select="$replabels/question-RelevantGESDescriptors" /></label></td>
    <td><span class="ta" >
      <xsl:for-each select="RelevantGESDescriptors">
        <!--<xsl:value-of select="string(.)" />-->
        <xsl:variable name="val" select="."/>
        <xsl:value-of select="$codelists/GESDescriptor[normalize-space(code)=$val]/label" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each></span></td>
  </tr>
</table>
</fieldset>
</xsl:template>

<xsl:template match="Measures | Exceptions" mode="RelevantFeaturesFromMSFDAnnexIII">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-RelevantFeaturesFromMSFDAnnexIII" /></legend>
  <table class="qa-table">
  <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
  <tr>
    <td><label class="label" ><xsl:value-of select="$replabels/question-RelevantFeaturesFromMSFDAnnexIII" /></label></td>
    <td><span class="ta" >
      <xsl:for-each select="RelevantFeaturesFromMSFDAnnexIII">
        <xsl:value-of select="string(.)" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each></span></td>
  </tr>
</table>
</fieldset>
</xsl:template>

<xsl:template match="Measures | Exceptions" mode="SpatialScopeGeographicZones">
  <xsl:param name="replabels" />
<fieldset class="group" >
<legend><xsl:value-of select="$replabels/topic-SpatialScopeGeographicZones" /></legend>
  <table class="qa-table">
  <tr><th class="q-cell"></th><th class="a-cell"></th></tr>
  <tr>
    <td><label class="label" ><xsl:value-of select="$replabels/question-SpatialScopeGeographicZones" /></label></td>
    <td><span class="ta" >
      <xsl:for-each select="SpatialScopeGeographicZones">
        <!--<xsl:value-of select="string(.)" />-->
        <xsl:variable name="val" select="."/>
        <xsl:value-of select="$codelists/MSFDImplementationZones[normalize-space(code)=$val]/label" />
        <xsl:if test="position() != last()">
          <xsl:text>, </xsl:text>
          <br/>
        </xsl:if>
      </xsl:for-each></span></td>
  </tr>
</table>
</fieldset>
</xsl:template>
  

  <xsl:template match="Measures" mode="LinkToExistingPolicies">
  <xsl:param name="replabels" />
    <fieldset class="group" >
      <legend>
        <xsl:value-of select="$replabels/topic-LinkToExistingPolicies" />
      </legend>
      <table class="qa-table">
        <tr>
          <th class="q-cell"></th>
          <th class="a-cell"></th>
        </tr>
        <tr>
          <td>
            <label class="label" >
              <xsl:value-of select="$replabels/question-LinkToExistingPolicies" />
            </label>
          </td>
          <td>
            <span class="ta" >
              <xsl:for-each select="LinkToExistingPolicies">
                <!--<xsl:value-of select="string(.)" />-->
                <xsl:variable name="val" select="."/>
                <xsl:value-of select="$codelists/LinkToExistingPolicies[normalize-space(code)=$val]/label" />
                <xsl:if test="position() != last()">
                  <xsl:text>, </xsl:text>
                  <br/>
                </xsl:if>
              </xsl:for-each>
            </span>
          </td>
        </tr>
        <xsl:if test="(normalize-space(LinkToExistingPoliciesOther) != '')">
          <tr>
            <td>
              <label class="label" >
                <xsl:value-of select="$replabels/question-LinkToExistingPoliciesOther" />
              </label>
            </td>
            <td>
              <span class="ta" >
                <xsl:for-each select="LinkToExistingPoliciesOther">
                  <xsl:value-of select="string(.)" />
                  <xsl:if test="position() != last()">
                    <xsl:text>, </xsl:text>
                    <br/>
                  </xsl:if>
                </xsl:for-each>
              </span>
            </td>
          </tr>
        </xsl:if>
      </table>
    </fieldset>
  </xsl:template>


  <xsl:template name="Index" match="POM" mode="Index">
<fieldset class="group" >
<legend class="label">Index</legend><span>
<dl>
  <dt><a href="#info"><xsl:value-of select="$labels/title-info" /></a></dt>
  <xsl:if test="Measures">
    <dt><xsl:value-of select="$labels/Measures/title-report-list" /></dt>
    <xsl:for-each select="Measures">
      <dd>
        <xsl:variable name="uc" select="UniqueCode"/>
        <a href="#{generate-id($uc)}">
          <xsl:value-of select="UniqueCode" />
        </a>
      </dd>
    </xsl:for-each>
  </xsl:if>
  <xsl:if test="Exceptions">
    <dt><xsl:value-of select="$labels/Exceptions/title-report-list" /></dt>
    <xsl:for-each select="Exceptions">
      <dd>
        <xsl:variable name="uc" select="UniqueCode"/>
        <a href="#{generate-id($uc)}">
          <xsl:value-of select="UniqueCode" />
        </a>
      </dd>
    </xsl:for-each>
  </xsl:if>
</dl>
</span>
</fieldset>
</xsl:template>

</xsl:stylesheet>