XML schema |
http://dd.eionet.europa.eu/schemas/CO2-monitoring-cars_2014/cars-detailed.xsd
|
---|---|
Output type | HTML |
Description | HTML table |
XSL file | cars_co2_detailed_html_2014.xsl (Last modified: 28 Jan 2014 09:44 ) |
<?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$ For http://dd.eionet.europa.eu/schemas/CO2-monitoring-cars_2014/cars-detailed.xsd --> <xsl:variable name="heading" select="'CO2 Emissions for cars - detailed data'"/> <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="vehicles/item"/> </table> </body> </html> </xsl:template> <xsl:template match="vehicles/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="/vehicles/@Y" /></td> </tr> <tr> <th>Member State</th> <td><xsl:value-of select="/vehicles/@MS" /></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="Tan" heading="Type approval number"/> <element name="T" heading="Type"/> <element name="Va" heading="Variant"/> <element name="Ve" heading="Version"/> <element name="Mk" heading="Make"/> <element name="Cn" heading="Commercial Name"/> <element name="Ct" heading="Category"/> <element name="R" heading="Registrations"/> <element name="M" heading="Mass"/> <element name="E" heading="Emissions"/> <element name="W" heading="Wheelbase"/> <element name="At1" heading="Axle track of steered axle"/> <element name="At2" heading="Axle track of other axle"/> <element name="Ft" heading="Fuel type"/> <element name="Fm" heading="Fuel mode"/> <element name="Ec" heading="Engine capacity"/> <element name="Ep" heading="Engine power"/> <element name="Z" heading="Electric energy consumption"/> <element name="IT" heading="Innovative technology"/> <element name="Er" heading="Emission reduction"/> </xsl:variable> </xsl:stylesheet>
European Environment Agency
Kgs. Nytorv 6, DK-1050 Copenhagen K, Denmark