2017 Meeskond Poly: Difference between revisions
From ICO wiki test
Jump to navigationJump to search
Changed first entries name and country to have a better result for XSLTs |
m Changed Lithuanias value |
||
| Line 14: | Line 14: | ||
<wind unit="m/s">1.7</wind> | <wind unit="m/s">1.7</wind> | ||
<power unit="kWh"> | <power unit="kWh"> | ||
<now>0</now> | <now>0.3</now> | ||
<month>2700</month> | <month>2700</month> | ||
<year>48275</year> | <year>48275</year> | ||
Revision as of 23:15, 19 March 2017
Meeskond
- Kristian Kalm
- Roland Kontson
XML
Dokumendid
XML
<?xml version="1.0" encoding="utf-8" ?>
<parks>
<park id="1">
<name>SUDENAI</name>
<country iso="LIT">Lithuania</country>
<wind unit="m/s">1.7</wind>
<power unit="kWh">
<now>0.3</now>
<month>2700</month>
<year>48275</year>
</power>
<turbines>
<active>7</active>
<total>8</total>
<power unit="kWh">24</power>
</turbines>
</park>
<park id="2">
<name>Paldiski</name>
<country iso="EST">Estonia</country>
<wind unit="m/s">3</wind>
<power unit="kWh">
<now>0.2</now>
<month>6400</month>
<year>80224</year>
</power>
<turbines>
<active>17</active>
<total>18</total>
<power unit="kWh">45</power>
</turbines>
</park>
<park id="3">
<name>Tooma I</name>
<country iso="EST">Estonia</country>
<wind unit="m/s">5.3</wind>
<power unit="kWh">
<now>2.1</now>
<month>2500</month>
<year>33317</year>
</power>
<turbines>
<active>8</active>
<total>8</total>
<power unit="kWh">16</power>
</turbines>
</park>
<park id="4">
<name>Tooma II</name>
<country iso="EST">Estonia</country>
<wind unit="m/s">5.2</wind>
<power unit="kWh">
<now>1.2</now>
<month>999</month>
<year>9170</year>
</power>
<turbines>
<active>3</active>
<total>3</total>
<power unit="kWh">7</power>
</turbines>
</park>
</parks>
XSD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="parks">
<xs:complexType>
<xs:sequence>
<xs:element name="park">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="country">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="iso" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="wind">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="power">
<xs:complexType>
<xs:sequence>
<xs:element name="now" type="xs:decimal" />
<xs:element name="month" type="xs:unsignedShort" />
<xs:element name="year" type="xs:unsignedInt" />
</xs:sequence>
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="turbines">
<xs:complexType>
<xs:sequence>
<xs:element name="active" type="xs:unsignedShort" />
<xs:element name="total" type="xs:unsignedShort" />
<xs:element name="power">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:unsignedShort">
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT HTML
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<h2>Wind parks in Estonia</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Wind speed</th>
<th>Power</th>
<th>Turbines</th>
<th>Annual</th>
</tr>
<xsl:for-each select="parks/park">
<xsl:sort select="name"/>
<xsl:if test="country/@iso = 'EST'">
<tr>
<xsl:attribute name="id">
<xsl:value-of select="concat('park_',@id)"/>
</xsl:attribute>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="concat(wind, ' ', wind/@unit)"/>
</td>
<td>
<xsl:value-of select="power/now"/>
<xsl:value-of select="power/@unit"/>
<xsl:value-of select="concat(' of ',turbines/power)"/>
<xsl:value-of select="turbines/power/@unit"/>
</td>
<td>
<xsl:value-of select="turbines/active"/>/<xsl:value-of select="turbines/total"/>
</td>
<td>
<xsl:value-of select="power/year"/>
<xsl:value-of select="substring(power/@unit,1,2)"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSLT XML
Retsensioonid
...TODO
Veebiteenus
...TODO
Klientrakendused
...TODO