XML schema |
http://acm.eionet.europa.eu/schemas/reg2009443ec/vans_aggregated-2012.xsd
|
---|---|
Output type | HTML |
Description | HTML table |
XSL file | vans_co2_aggregations_html_2012.xsl (Last modified: 28 Nov 2011 13:35 ) |
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <!-- $Id: vans_co2_aggregations_html_2012.xsl 10812 2011-11-28 11:33:05Z kasperen $ For http://acm.eionet.europa.eu/schemas/reg2009443ec/vans_aggregated-2012.xsd --> <xsl:variable name="heading" select="'CO2 Emissions for vans - aggregates'"/> <xsl:template match="/"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title><xsl:value-of select="$heading"/></title> <style type="text/css"> table { border-collapse:collapse; } td, th { border:1px solid black; padding:2px; } #metadata th{ text-align:right; } </style> </head> <body> <h1><xsl:value-of select="$heading"/></h1> <xsl:call-template name="metadata-table"/> <br/> <table> <xsl:apply-templates select="VansAggregates/item"/> </table> </body> </html> </xsl:template> <xsl:template match="VansAggregates/item"> <xsl:if test="position()=1"> <xsl:call-template name="header"/> </xsl:if> <xsl:variable name="vehicleRow" select="."/> <tr> <xsl:for-each select="$elements/element"> <xsl:variable name="elemName" select="@name"/> <xsl:variable name="elemValue" select="$vehicleRow/*[local-name() = $elemName]"/> <td> <xsl:if test="$elemValue = ''"> </xsl:if> <xsl:value-of select="$elemValue"/> </td> </xsl:for-each> </tr> </xsl:template> <xsl:template name="header"> <tr> <xsl:for-each select="$elements/element"> <th style="background-color:#87cefa"> <xsl:value-of select="@heading"/> </th> </xsl:for-each> </tr> </xsl:template> <xsl:template name="metadata-table"> <table id="metadata"> <tr> <th>Year</th> <td><xsl:value-of select="/VansAggregates/@Y" /></td> </tr> <tr> <th>Member State</th> <td><xsl:value-of select="/VansAggregates/@MS" /></td> </tr> <tr> <th>Data source</th> <td><xsl:value-of select="/VansAggregates/@DS" /></td> </tr> <tr> <th>Temporary registrations</th> <td><xsl:value-of select="/VansAggregates/@Tr" /></td> </tr> </table> </xsl:template> <xsl:variable name="elements"> <element name="ID" heading="ID" /> <element name="Mh" heading="EU Manufacturer Name"/> <element name="Man" heading="Manufacturer" /> <element name="MMS" heading="Manufacturer National" /> <element name="Rt" heading="Registrations" /> <element name="Re" heading="# CO2 emission value" /> <element name="Rm" heading="# mass value" /> <element name="Rw" heading="# wheelbase" /> <element name="Rat1" heading="# axle value" /> <element name="Rat2" heading="# having an axle (other) value" /> <element name="Eav" heading="Average CO2 Emissions" /> <element name="Mav" heading="Average Mass" /> <element name="Fav" heading="Average Footprint" /> </xsl:variable> </xsl:stylesheet>
European Environment Agency
Kgs. Nytorv 6, DK-1050 Copenhagen K, Denmark