| XML schema |
http://dd.eionet.europa.eu/schemas/CO2-monitoring-cars_2014/cars-aggregated.xsd
|
|---|---|
| Output type | EXCEL |
| Description | MS Excel |
| XSL file | cars_co2_aggregations_excel_2014.xsl (Last modified: 28 Jan 2014 10:17 ) |
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:office="http://openoffice.org/2000/office"
xmlns:table="http://openoffice.org/2000/table" xmlns:text="http://openoffice.org/2000/text">
<xsl:output method="xml"/>
<!--
$Id$
For http://dd.eionet.europa.eu/schemas/CO2-monitoring-cars_2014/cars-aggregated.xsd
-->
<xsl:variable name="heading" select="'CO2-cars-aggregated'" />
<xsl:template match="/">
<office:document-content xmlns:office="http://openoffice.org/2000/office"
xmlns:table="http://openoffice.org/2000/table" office:version="1.0"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:number="http://openoffice.org/2000/datastyle"
xmlns:text="http://openoffice.org/2000/text" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:style="http://openoffice.org/2000/style">
<office:automatic-styles>
<style:style style:name="cell1" style:family="table-cell">
<style:properties fo:text-align="left"
fo:font-size="10pt" />
</style:style>
<style:style style:name="cell2" style:family="table-cell">
<style:properties fo:text-align="center"
fo:font-size="12pt" fo:font-style="italic" />
</style:style>
<style:style style:name="Heading1" style:family="table-cell">
<style:properties fo:text-align="left"
fo:font-size="10pt" fo:font-style="italic"
style:text-align-source="fix" fo:font-weight="bold" />
</style:style>
<style:style style:name="Heading2" style:family="table-cell">
<style:properties fo:text-align="center"
fo:font-size="10pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Heading3" style:family="table-cell">
<style:properties fo:text-align="Right"
fo:font-size="10pt" fo:font-weight="bold" style:column-width="5cm"/>
</style:style>
</office:automatic-styles>
<office:body>
<table:table>
<xsl:attribute name="table:name"><xsl:value-of select="$heading" /></xsl:attribute>
<table:table-columns>
<table:table-column
table:default-cell-value-type="number"
table:default-cell-style-name="cell1">
<xsl:attribute name="table:number-columns-repeated"><xsl:value-of
select="count($elements/element)" /></xsl:attribute>
</table:table-column>
</table:table-columns>
<!-- create header rows -->
<table:table-rows>
<xsl:apply-templates select="aggregates/item" />
</table:table-rows>
</table:table>
<xsl:call-template name="metadata-table" />
</office:body>
</office:document-content>
</xsl:template>
<xsl:template match="aggregates/item">
<xsl:if test="position()=1">
<xsl:call-template name="header" />
</xsl:if>
<xsl:variable name="vehicleRow" select="."/>
<table:table-row>
<xsl:for-each select="$elements/element">
<xsl:variable name="elemName" select="@name"/>
<xsl:variable name="elemValue" select="$vehicleRow/*[local-name() = $elemName]"/>
<table:table-cell>
<text:p>
<xsl:value-of select="$elemValue"/>
</text:p>
</table:table-cell>
</xsl:for-each>
</table:table-row>
</xsl:template>
<!-- a named template, which creates the table header row -->
<xsl:template name="header">
<table:table-header-rows>
<table:table-row table:default-cell-value-type="string"
table:default-cell-style-name="Heading2">
<xsl:for-each select="$elements/element">
<table:table-cell>
<text:p>
<xsl:value-of select="@heading"/>
</text:p>
</table:table-cell>
</xsl:for-each>
</table:table-row>
</table:table-header-rows>
</xsl:template>
<xsl:template name="metadata-table">
<table:table>
<xsl:attribute name="table:name">Metadata</xsl:attribute>
<table:table-columns>
<table:table-column
table:default-cell-value-type="string"
table:default-cell-style-name="Heading3" />
<table:table-column
table:default-cell-value-type="string"
table:default-cell-style-name="cell1" />
</table:table-columns>
<table:table-rows>
<xsl:variable name="rootAttributes" select="/aggregates/attribute::*"/>
<xsl:for-each select="$attributes/attr">
<xsl:variable name="attrName" select="@name"/>
<xsl:variable name="attrValue" select="$rootAttributes[name()=$attrName]" />
<table:table-row>
<table:table-cell table:style-name="Heading3">
<text:p><xsl:value-of select="@heading" /></text:p>
</table:table-cell>
<table:table-cell table:style-name="cell1">
<text:p><xsl:value-of select="$attrValue" /></text:p>
</table:table-cell>
</table:table-row>
</xsl:for-each>
</table:table-rows>
</table: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="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:variable name="attributes">
<attr name="Y" heading="Year" />
<attr name="MS" heading="Member State" />
<attr name="DS" heading="Data source" />
<attr name="FSP" heading="Percentage of E85 stations" />
<attr name="NFS" heading="Total number of fuel filling stations" />
<attr name="Rt" heading="Registrations" />
<attr name="Re" heading="Registrations with CO2 emission value" />
<attr name="Rm" heading="Registrations with mass value" />
</xsl:variable>
</xsl:stylesheet>
European Environment Agency
Kgs. Nytorv 6, DK-1050 Copenhagen K, Denmark