View stylesheet

XML schemas eper.xsd
http://dd.eionet.europa.eu/schemas/eper/eper.xsd
Output type HTML
Description HTML factsheet
XSL file eperfactsheet.xslt (Last modified: 21 Nov 2007 16:16 )
<?xml version="1.0"?>
<!--
      Generate html 
  -->
<xsl:stylesheet
 exclude-result-prefixes="html"
 xmlns:html="http://www.w3.org/TR/REC-html40"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

 <xsl:output method="xml" 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:template match="report">
<html>
 <head>
 <title>EPER report</title>
 <style type="text/css">
table,th,td { border: 1px solid #111; border-collapse: collapse;}
th, td { padding: 0.3em; }
th { background-color: #87CEFA;}
th.scope-row { text-align: left; }
 </style>
 </head>
 <body>
    <h1>EPER report</h1>
    <p><strong>This output is intended to give a quick overview of the delivery. There might be information in
    the delivery that is not shown here.</strong></p>
    <table>
     <xsl:apply-templates mode="simple"/>
    </table>
     <xsl:apply-templates select="Facility" mode="table"/>
 </body>
</html>
</xsl:template>

<xsl:template match="Facility" mode="simple"/>

<xsl:template match="Facility" mode="table">
   <h2><xsl:value-of select="FacilityName"/></h2>
    <table>
     <xsl:apply-templates mode="simple"/>
    </table>
    <h3>Activities</h3>
    <table>
     <xsl:apply-templates select="Activity" mode="table"/>
    </table>
    <h3>Emissions</h3>
    <table>
     <xsl:apply-templates select="Emission" mode="table"/>
    </table>
</xsl:template>

<xsl:template match="Activity|Emission" mode="simple"/>

<!--
<xsl:template match="Activity|Emission" mode="table">
    <table border="1">
     <xsl:apply-templates mode="simple"/>
    </table>
</xsl:template>
-->

<xsl:template match="Activity|Emission" mode="table">
    <xsl:if test="position()=1">
        <xsl:call-template name="header"/>
    </xsl:if>
    <tr><xsl:for-each select="*">
        <td> <xsl:if test=".=''">   </xsl:if>  <xsl:value-of select="." /> </td>
    </xsl:for-each></tr>
</xsl:template>

<xsl:template match="*" mode="simple">
    <tr>
    <th class="scope-row" scope="row"><xsl:value-of select="local-name()" /></th>
    <td><xsl:value-of select="." /></td>
    </tr>
</xsl:template>

<xsl:template match="*" mode="table"/>

<xsl:template name="header">
    <tr><xsl:for-each select="*">
    <th><xsl:value-of select="local-name()" />
    </th>
    </xsl:for-each>
    </tr>
</xsl:template>

</xsl:stylesheet>