View stylesheet

XML schemas http://water.eionet.europa.eu/schemas/dir91271eec/UWWTD2011.xsd
Output type HTML
Description Show as HTML
XSL file UWWTD2011-html.xsl (Last modified: 13 Jun 2014 17:15 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>

    <xsl:template match="/">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Urban Waste Water Treatment Data</title>
    <style type="text/css">
    table { border: 1px solid black; border-collapse: collapse; margin:.3em}
    th { background-color: #87CEFA; }
    th.row { text-align:left; }
    th, td { border: 1px solid black; padding: 0.3em;}
    caption { font-size: 130%; text-align:left; margin-top: 1em;}
    .number { text-align: right; }
    </style>
  </head>
  <body>
    <h1>Urban Waste Water Treatment Data</h1>
    <xsl:apply-templates/>
  </body>
</html>
    </xsl:template>

    <xsl:template match="UWWTD_Data">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="UWWTD_Report">
    <h2>Exported: <xsl:value-of select="@rptDateexported"/></h2>
    <table border="1">
        <xsl:apply-templates select="Reporter"/>
        <xsl:apply-templates select="ReportPeriod"/>
        <xsl:apply-templates select="ReceivingAreas"     mode="fulltable"/>
        <xsl:apply-templates select="Agglomerations"     mode="fulltable"/>
        <xsl:apply-templates select="BigCityDischargers" mode="fulltable"/>
        <xsl:apply-templates select="UWWTPs"             mode="fulltable"/>
        <xsl:apply-templates select="UwwtpAgglos"        mode="fulltable"/>
        <xsl:apply-templates select="DischargePoints"    mode="fulltable"/>
        <xsl:apply-templates select="Industries"         mode="fulltable"/>
        <xsl:apply-templates select="MSLevel"/>
    </table>
    </xsl:template>


    <xsl:template match="*" mode="fulltable">
        <table>
            <caption><xsl:value-of select="local-name()" /></caption>
            <xsl:for-each select="*"> <!-- Assumes the first row has all the elements -->
                <xsl:if test="position()=1">
                    <xsl:call-template name="header"/>
                </xsl:if>
                <tr>
                    <xsl:apply-templates  mode="tablebody"/>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>

    <xsl:template match="*" mode="tablebody">
            <td><xsl:if test=".=''">&#160;</xsl:if><xsl:value-of select="." /></td>
    </xsl:template>

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

    <xsl:template match="Reporter|ReportPeriod|MSLevel">
      <table>
          <caption><xsl:value-of select="local-name()" /></caption>
          <xsl:apply-templates mode="factsheet"/>
      </table>
    </xsl:template>

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