View stylesheet

XML schema http://dd.eionet.europa.eu/schemas/IEDAnnexIIModule1/module1.xsd
Output type HTML
Description HTML preview
XSL file IEDAnnexIIModule1-html.xsl (Last modified: 08 Nov 2018 19:46 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <xsl:output method="html" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        omit-xml-declaration="yes"/>

    <xsl:variable name="AnnexIHeadingCodeURL"
        select="document('http://dd.eionet.europa.eu/vocabulary/IEDAnnexIIModule1/AnnexIHeadingCode/rdf')"/>

    <!-- <xsl:variable name="labelsLanguage" select="IEDModule1/@xml:lang"/> -->

    <!-- <xsl:variable name="labels" select="document('http://converterstest.eionet.europa.eu/xmlfile/IEDAnnexIIModule1-labels-en.xml')/labels"/> -->

    <xsl:variable name="schema"
                  select="document('http://dd.eionet.europa.eu/schemas/IEDAnnexIIModule1/module1.xsd')/xs:schema"/>
    <xsl:variable name="labelsLanguage" select="IEDModule1/@xml:lang"/>
    <xsl:variable name="xmlPath" select="'https://converterstest.eionet.europa.eu/xmlfile'"/>
    <xsl:variable name="labelsUrl">
        <xsl:choose>
            <xsl:when test="doc-available(concat($xmlPath, 'IEDAnnexIIModule1-labels-', $labelsLanguage ,'.xml'))">
                <xsl:value-of select="concat($xmlPath, 'IEDAnnexIIModule1-labels-', $labelsLanguage ,'.xml')"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="concat($xmlPath, '/IEDAnnexIIModule1-labels-en.xml')"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="labels" select="document($labelsUrl)/labels"/>

    
    <xsl:template name="getLabel">
        <xsl:param name="labelName"/>
        <xsl:variable name="labelValue" select="$labels/*[local-name() = $labelName]"/>
        <xsl:choose>
            <xsl:when test="string-length($labelValue) &gt; 0">
                <xsl:value-of disable-output-escaping="yes" select="$labelValue"/>
            </xsl:when>
            <xsl:otherwise>- <xsl:value-of disable-output-escaping="yes" select="$labelName"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <xsl:template name="getYesNoValue">
        <xsl:param name="elem"/>
        <xsl:param name="codelistElement" select="''"/>
        <xsl:variable name="elemValue">
            <xsl:choose>
                <xsl:when test="$elem/text()='true'">Yes</xsl:when>
                <xsl:when test="$elem/text()='false'">No</xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$elem"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:value-of select="$elemValue"/>
    </xsl:template>

    <xsl:template name="getCDLValue">
        <xsl:param name="elem"/>
        <xsl:param name="codelistElement" select="''"/>
        <xsl:variable name="codeValue"
            select="$AnnexIHeadingCodeURL/rdf:RDF/skos:Concept/skos:notation[text()= $elem/text()]/../skos:prefLabel/text()"/>
        <xsl:choose>
            <xsl:when test="codeValue = ''">
                <xsl:value-of disable-output-escaping="yes" select="$elem"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of disable-output-escaping="yes" select="$codeValue"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <!--
    <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 match="/">
        <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <title>
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'Questionnaire-title'"/>
                    </xsl:call-template>
                </title>
                <meta content="text/html; charset=utf-8"/>
                <style type="text/css">
                    /*@media print{@page {size: landscape}}*/
                    @page {
                        size: A4;
                        /*margin: 0;*/
                        margin-right: 0.5em;
                        margin-left: 0.5em;
                    }
                    @media print {

                        html, body {
                            width: 210mm;
                            height: 297mm;
                        }
                        @page {size: landscape}
                        table { page : rotated}
                        table{  font-size: 6pt;}
                        th { page-break-inside : avoid }
                        td { page-break-inside : avoid;  white-space: pre-line;}
                        tr { page-break-inside : avoid }
                        /*.table-2{ page-break-inside : avoid}*/
                        #table-3 { display: none; !important}
                        .table-3-print{display: inherit !important}
                        /*.table-3-print{ page-break-inside : avoid !important;}*/
                        .table-3-print, .table-3-print tr , .table-3-print tr td{width: 100% !important;padding-bottom: 1em;}
                        .table-3-print-all, .table-3-print-all table {width: 100% !important; display: inherit !important; }
                        #table-3-main-h2{display: none !important;}
                        h2 { page-break-after : avoid }
                        @page{orphans:4; widows:2;}

                        #table-6 { display: none; !important}
                        .table-6-print{display: inherit !important; padding-bottom: 1em;}

                        th{text-align: center !important;
                            padding: 0;}
                        td{ padding: 0;}

                    }
                    /*@media print{@page {
                        -webkit-transform: rotate(-90deg); -moz-transform:rotate(-90deg);
                        filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
                    }*/
                    #table-3-main-h2{display: inherit;}
                    .table-3-print-all{display: none;}
                    .table-3-print{display: none;}
                    .table-6-print{display: none;}
                    body {
                        font-size: 80%;
                        font-family: verdana, helvetica, arial, sans-serif;
                        color: #333;
                        margin-left:30px;
                    }
                    h1 {
                        font-size: 160%;
                        color: #315076;
                        text-align: center;
                        padding-bottom: 0.5em;
                        font-style: italic;
                    }
                    h2 {
                        font-size: 130%;
                        border-bottom: 1px solid #999999;
                        font-style: italic;
                        margin-left:-25px;
                    }
                    h3{
                        font-size: 110%;
                        color: #315076;
                        margin-left:-25px;
                    }
                    h4{
                        font-size: 110%;
                        color: #315076;
                        margin-top: 10px;
                        margin-bottom: 5px;
                    }
                    caption {
                        display: none;
                        font-family: vardana, verdana, helvetica, arial, sans-serif;
                        text-align: left;
                        font-size: 150%;
                    }

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

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

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

                    sup {
                        font-size: 0.8em;
                        font-style: italic;
                        color: #777;
                    }
                    .note{
                        font-size: 0.8em;
                        font-weight: normal;
                        color: #315076;
                    }
                    .value {
                        background-color: #ffffe0;
                    }
                    .disabled td{
                        background-color:lightgrey;
                    }
                    .italicTableHeading{
                        font-style: italic;
                        color: black;
                        margin-left: 1em;
                    }
                    .total {
                        font-weight: bold;
                    }
                    .note{ color: darkblue;}
                    .sub-header{ font-weight: bold;
                        color: #000000;
                        font-size: larger;}
                    .padding-bottom{
                        padding-bottom: 2em;
                    }
                </style>
            </head>
            <body>
                <h1>
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'Questionnaire-title'"/>
                    </xsl:call-template>
                </h1>

                <xsl:apply-templates/>
                <div class="padding-bottom"/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="IEDModule1/ImplementationChanges">
        <h2>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'implementationChanges'"/>
            </xsl:call-template>
        </h2>
        <h3>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'question1'"/>
            </xsl:call-template>
        </h3>
        <p>
            <xsl:call-template name="getYesNoValue">
                <xsl:with-param name="elem" select="q_1_changesMade"/>
            </xsl:call-template>
        </p>

        <xsl:if test="q_1_changesMade = true()">
            <table id="table-2">
                <tr>

                    <th>
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'question1_1'"/>
                        </xsl:call-template>
                    </th>
                    <th >
                        <xsl:call-template name="getLabel">
                            <xsl:with-param name="labelName" select="'question1_1_description'"/>
                        </xsl:call-template>
                    </th>
                </tr>

                <xsl:for-each select="./ReasonsChanges">
                    <tr>
                        <td>
                            <xsl:call-template name="getCDLValue">
                                <xsl:with-param name="elem" select="./Headings/q_1_1_heading"/>
                                <xsl:with-param name="codelistElement" select="'AnnexIHeadingCode'"/>
                            </xsl:call-template>

                            <!--<xsl:call-template name="getValue"><xsl:with-param name="elem" select="./Headings/q_1_1_heading"/></xsl:call-template>-->
                        </td>
                        <td>
                            <xsl:value-of select="q_1_1_description"/>
                        </td>
                    </tr>

                </xsl:for-each>
            </table>
        </xsl:if>
       
    </xsl:template>
    
    
    <xsl:template match="IEDModule1/ImplementationDifficulties">
        
        <div id="table-3-main-h2">
            <h2>
                <xsl:call-template name="getLabel">
                    <xsl:with-param name="labelName" select="'implementationDifficulties'"/>
                </xsl:call-template>
            </h2>
        </div>
        
        
        <h3>
            <xsl:call-template name="getLabel">
                <xsl:with-param name="labelName" select="'questions1_2'"/>
            </xsl:call-template>
        </h3>
        <p>
            <xsl:call-template name="getYesNoValue">
                <xsl:with-param name="elem" select="q_2_1_difficultiesEncountered"/>
            </xsl:call-template>
        </p>
        <xsl:if test="q_2_1_difficultiesEncountered = true()">
        
        <table  id="table-3" >
            <tr>
                <th>
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'questions1_2_1_table_1'"/>
                    </xsl:call-template>
                </th>
                <th>
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'questions1_2_1_table_2'"/>
                    </xsl:call-template>
                </th>
                <th>
                    <xsl:call-template name="getLabel">
                        <xsl:with-param name="labelName" select="'questions1_2_1_table_3'"/>
                    </xsl:call-template>
                </th>
                
            </tr>
            
            <xsl:for-each select="./Difficulty">
                <tr>
                    <td>
                        <xsl:value-of select="./q_2_2_relevantArticle"/>
                        
                    </td>
                    <td>
                        <xsl:value-of select="./q_2_2_description"/>
                    </td>
                    <td>
                        <xsl:value-of select="./q_2_2_reasons"/>
                    </td>
                    
                </tr>
            </xsl:for-each>
        </table>
            </xsl:if>
        </xsl:template>
    
</xsl:stylesheet>