View stylesheet

XML schemas http://www.eionet.europa.eu/schemas/ippc-wi/dir20081_schema.xsd
Output type HTML
Description Simple HTML factsheet
XSL file dir20081_html.xsl (Last modified: 10 Aug 2009 17:45 )
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: dir20081_html.xsl 246 2009-07-23 16:35:36Z sebf $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:output method="html" encoding="utf-8"/>
    <xsl:param name="xml_folder_uri"/>
    <xsl:variable name="directiveid">20081</xsl:variable>
    <xsl:variable name="directiveidfull" select="concat('Quest', $directiveid, '-')"/>
    <xsl:variable name="labels" select="document(concat($xml_folder_uri,concat('dir', $directiveid, '_xsl_labels.xml')))/labels/itemset[@xml:lang='en']"/>



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

    <xsl:template match="Questionnaire">
        <html>
            <head>
                <title>
                    Factsheet of IPPC delivery
                </title>
                <style type="text/css">
                table { border: 1px solid black; border-collapse: collapse}
                table th, table td { text-align: left; border: 1px solid black; }
                .tophead, .questionid { background-color:#CCCCCC; }
                </style>
            </head>
            <body>
                <table class="bluetable">
                    <col style="width:15%"/>
                    <col style="width:30%"/>
                    <col style="width:55%"/>
                    <tr class="tophead">
                        <th>Question ID</th>
                        <th>Question</th>
                        <th>Answer</th>
                    </tr>

                    <xsl:apply-templates/>
                </table>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="*">
        <tr>
            <th class="questionid"><xsl:value-of select="local-name()"/></th>
            <xsl:variable name="questionid" select="substring-after(local-name(),$directiveidfull)"/>
            <xsl:choose>
                <xsl:when test="$labels/item[@id=$questionid] != ''">
                    <th><xsl:value-of select="$labels/item[@id=$questionid]"/></th>
                </xsl:when>
                <xsl:otherwise>
                    <th><xsl:value-of select="local-name()"/></th>
                </xsl:otherwise>
            </xsl:choose>
            <td><xsl:value-of select="text()"/></td>
        </tr>
    </xsl:template>

</xsl:stylesheet>