YAWS: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Akepler (talk | contribs)
Akepler (talk | contribs)
 
(3 intermediate revisions by the same user not shown)
Line 40: Line 40:
         <location>
         <location>
             <!--Postal aadress-->
             <!--Postal aadress-->
             <aadress/>
             <aadress>
                Jaama 33, Põlva, ESTONIA
            </aadress>
             <!--GPS cordinates-->
             <!--GPS cordinates-->
             <geo>
             <geo>
                 <lat/>
                 <lat>
                 <long/>
                    58.0608893
                </lat>
                 <long>
                    27.067128399999998
                </long>
             </geo>
             </geo>
         </location>
         </location>
         <values>
         <values>
             <value property="airpressure" unit="hPa" > <![CDATA[1004.1]]></value>
             <airpressure unit="hPa" > <![CDATA[1004.1]]></airpressure>
             <value property="relativehumidity" unit="%" ><![CDATA[87]]></value>
             <relativehumidity unit="%" ><![CDATA[87]]></relativehumidity>
             <airtemperature max="50.0" min="-50.0">
             <airtemperature max="50.0" min="-50.0" unit="°C" >
                 <value property="airtemperature" unit="°C" ><![CDATA[-0.5]]></value>
                 <value><![CDATA[-0.5]]></value>
                 <value property="max" unit="°C" ><![CDATA[50.0]]></value>
                 <max><![CDATA[50.0]]></max>
                 <value property="min" unit="°C" ><![CDATA[-5.5]]></value>
                 <min><![CDATA[-5.5]]></min>
             </airtemperature>
             </airtemperature>
             <value property="winddirection" unit="°" ><![CDATA[207]]></value>
             <winddirection property="winddirection" unit="°" ><![CDATA[207]]></winddirection>
             <windspeed max="36" min="0">
             <windspeed max="36" min="0" unit="m/s">
                <value property="windspeed" unit="m/s" ><![CDATA[0.5]]></value>
                <value><![CDATA[0.5]]></value>
                 <value property="max" unit="m/s" ><![CDATA[2.1]]></value>
                 <max><![CDATA[2.1]]></max>
             </windspeed>
             </windspeed>
             <!--Calculated values if GPS cordinates is set-->
             <!--Calculated values if GPS cordinates is set-->
             <value property="sunrise" ><![CDATA[04:00]]></value>
             <sunrise><![CDATA[04:00]]></sunrise>
             <!--Calculated values if GPS cordinates is set-->
             <!--Calculated values if GPS cordinates is set-->
             <value property="sunset" ><![CDATA[02:00]]></value>
             <sunset ><![CDATA[02:00]]></sunset>
           
 
         </values>
         </values>
         <related_ehmi_stations>
         <related_ehmi_stations>
        <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
            <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
             <station>
             <station>
                 <name>Võru</name>
                 <name>Võru</name>
Line 81: Line 87:
                 <windspeedmax>2.1</windspeedmax>
                 <windspeedmax>2.1</windspeedmax>
             </station>
             </station>
           
 
             <station>
             <station>
                 <name>Valga</name>
                 <name>Valga</name>
Line 112: Line 118:
         </location>
         </location>
         <values>
         <values>
             <value property="airpressure" unit="hPa" > <![CDATA[1004.1]]></value>
             <airpressure unit="hPa" > <![CDATA[1004.1]]></airpressure>
             <value property="relativehumidity" unit="%" ><![CDATA[87]]></value>
             <relativehumidity unit="%" ><![CDATA[87]]></relativehumidity>
             <airtemperature max="50.0" min="-50.0">
             <airtemperature max="50.0" min="-50.0" unit="°C" >
                 <value property="airtemperature" unit="°C" ><![CDATA[-0.5]]></value>
                 <value><![CDATA[-0.5]]></value>
                 <value property="max" unit="°C" ><![CDATA[50.0]]></value>
                 <max><![CDATA[50.0]]></max>
                 <value property="min" unit="°C" ><![CDATA[-5.5]]></value>
                 <min><![CDATA[-5.5]]></min>
             </airtemperature>
             </airtemperature>
             <value property="winddirection" unit="°" ><![CDATA[207]]></value>
             <winddirection property="winddirection" unit="°" ><![CDATA[207]]></winddirection>
             <windspeed max="36" min="0">
             <windspeed max="36" min="0" unit="m/s">
                <value property="windspeed" unit="m/s" ><![CDATA[0.5]]></value>
                <value><![CDATA[0.5]]></value>
                 <value property="max" unit="m/s" ><![CDATA[2.1]]></value>
                 <max><![CDATA[2.1]]></max>
             </windspeed>
             </windspeed>
             <!--Calculated values if GPS cordinates is set-->
             <!--Calculated values if GPS cordinates is set-->
             <value property="sunrise" ><![CDATA[04:00]]></value>
             <sunrise><![CDATA[04:00]]></sunrise>
             <!--Calculated values if GPS cordinates is set-->
             <!--Calculated values if GPS cordinates is set-->
             <value property="sunset" ><![CDATA[02:00]]></value>
             <sunset ><![CDATA[02:00]]></sunset>
           
 
         </values>
         </values>
         <related_ehmi_stations>
         <related_ehmi_stations>
        <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
            <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
             <station>
             <station>
                 <name>Võru</name>
                 <name>Võru</name>
Line 145: Line 151:
                 <windspeedmax>2.1</windspeedmax>
                 <windspeedmax>2.1</windspeedmax>
             </station>
             </station>
           
 


         </related_ehmi_stations>
         </related_ehmi_stations>
     </record>
     </record>
</records>
</records>
   
</source>
</source>


Line 156: Line 161:


<source lang="xml">
<source lang="xml">
<?xml version="1.0"?>
 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
 
  <xs:element name="records" type="recordsType"/>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="geoType">
  <xs:element name="records">
    <xs:sequence>
    <xs:complexType>
      <xs:element type="xs:string" name="lat"/>
      <xs:sequence>
      <xs:element type="xs:string" name="long"/>
        <xs:element name="record" maxOccurs="unbounded" minOccurs="0">
    </xs:sequence>
          <xs:complexType>
  </xs:complexType>
            <xs:sequence>
  <xs:complexType name="locationType">
              <xs:element type="xs:string" name="username"/>
    <xs:sequence>
              <xs:element name="location">
      <xs:element type="xs:string" name="aadress">
                <xs:complexType>
      </xs:element>
                  <xs:sequence>
      <xs:element type="geoType" name="geo">
                    <xs:element type="xs:string" name="aadress">
      </xs:element>
                      <xs:annotation>
    </xs:sequence>
                        <xs:documentation>Postal aadressPostal aadress</xs:documentation>
  </xs:complexType>
                      </xs:annotation>
  <xs:complexType name="valueType">
                    </xs:element>
    <xs:simpleContent>
                    <xs:element name="geo">
      <xs:extension base="xs:string">
                      <xs:annotation>
        <xs:attribute type="xs:string" name="property" use="optional"/>
                        <xs:documentation>GPS cordinatesGPS cordinates</xs:documentation>
        <xs:attribute type="xs:string" name="unit" use="optional"/>
                      </xs:annotation>
      </xs:extension>
                      <xs:complexType>
    </xs:simpleContent>
                        <xs:sequence>
  </xs:complexType>
                          <xs:element type="xs:string" name="lat"/>
  <xs:complexType name="airtemperatureType" mixed="true">
                          <xs:element type="xs:string" name="long"/>
    <xs:sequence>
                        </xs:sequence>
      <xs:element type="valueType" name="value" maxOccurs="unbounded" minOccurs="0"/>
                      </xs:complexType>
    </xs:sequence>
                    </xs:element>
    <xs:attribute type="xs:float" name="max" use="optional"/>
                  </xs:sequence>
    <xs:attribute type="xs:float" name="min" use="optional"/>
                </xs:complexType>
    <xs:attribute type="xs:string" name="property" use="optional"/>
              </xs:element>
    <xs:attribute type="xs:string" name="unit" use="optional"/>
              <xs:element name="values">
  </xs:complexType>
                <xs:complexType>
  <xs:complexType name="windspeedType" mixed="true">
                  <xs:sequence>
    <xs:sequence>
                    <xs:element name="airpressure">
      <xs:element type="valueType" name="value" maxOccurs="unbounded" minOccurs="0"/>
                      <xs:complexType>
    </xs:sequence>
                        <xs:simpleContent>
    <xs:attribute type="xs:byte" name="max" use="optional"/>
                          <xs:extension base="xs:float">
    <xs:attribute type="xs:byte" name="min" use="optional"/>
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
    <xs:attribute type="xs:string" name="property" use="optional"/>
                          </xs:extension>
    <xs:attribute type="xs:string" name="unit" use="optional"/>
                        </xs:simpleContent>
  </xs:complexType>
                      </xs:complexType>
  <xs:complexType name="valuesType">
                    </xs:element>
    <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element name="relativehumidity">
      <xs:element type="valueType" name="value"/>
                      <xs:complexType>
      <xs:element type="airtemperatureType" name="airtemperature"/>
                        <xs:simpleContent>
      <xs:element type="windspeedType" name="windspeed">
                          <xs:extension base="xs:byte">
      </xs:element>
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
    </xs:choice>
                          </xs:extension>
  </xs:complexType>
                        </xs:simpleContent>
  <xs:complexType name="stationType">
                      </xs:complexType>
    <xs:sequence>
                    </xs:element>
      <xs:element type="xs:string" name="name"/>
                    <xs:element name="airtemperature">
      <xs:element type="xs:short" name="wmocode"/>
                      <xs:complexType>
      <xs:element type="xs:string" name="phenomenon"/>
                        <xs:sequence>
      <xs:element type="xs:float" name="visibility"/>
                          <xs:element type="xs:float" name="value"/>
      <xs:element type="xs:byte" name="precipitations"/>
                          <xs:element type="xs:float" name="max"/>
      <xs:element type="xs:float" name="airpressure"/>
                          <xs:element type="xs:float" name="min"/>
      <xs:element type="xs:byte" name="relativehumidity"/>
                        </xs:sequence>
      <xs:element type="xs:float" name="airtemperature"/>
                        <xs:attribute type="xs:float" name="max" use="optional"/>
      <xs:element type="xs:short" name="winddirection"/>
                        <xs:attribute type="xs:float" name="min" use="optional"/>
      <xs:element type="xs:float" name="windspeed"/>
                        <xs:attribute type="xs:string" name="unit" use="optional"/>
      <xs:element type="xs:float" name="windspeedmax"/>
                      </xs:complexType>
    </xs:sequence>
                    </xs:element>
  </xs:complexType>
                    <xs:element name="winddirection">
  <xs:complexType name="related_ehmi_stationsType">
                      <xs:complexType>
    <xs:sequence>
                        <xs:simpleContent>
      <xs:element type="stationType" name="station" maxOccurs="unbounded" minOccurs="0">
                          <xs:extension base="xs:short">
      </xs:element>
                            <xs:attribute type="xs:string" name="property" use="optional"/>
    </xs:sequence>
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
  </xs:complexType>
                          </xs:extension>
  <xs:complexType name="recordType">
                        </xs:simpleContent>
    <xs:sequence>
                      </xs:complexType>
      <xs:element type="xs:string" name="username"/>
                    </xs:element>
      <xs:element type="locationType" name="location"/>
                    <xs:element name="windspeed">
      <xs:element type="valuesType" name="values"/>
                      <xs:complexType>
      <xs:element type="related_ehmi_stationsType" name="related_ehmi_stations"/>
                        <xs:sequence>
    </xs:sequence>
                          <xs:element type="xs:float" name="value"/>
  </xs:complexType>
                          <xs:element type="xs:float" name="max"/>
  <xs:complexType name="recordsType">
                        </xs:sequence>
    <xs:sequence>
                        <xs:attribute type="xs:byte" name="max" use="optional"/>
       <xs:element type="recordType" name="record" maxOccurs="unbounded" minOccurs="0"/>
                        <xs:attribute type="xs:byte" name="min" use="optional"/>
    </xs:sequence>
                        <xs:attribute type="xs:string" name="unit" use="optional"/>
    <xs:attribute type="xs:string" name="start_date"/>
                      </xs:complexType>
    <xs:attribute type="xs:string" name="end_date"/>
                    </xs:element>
   </xs:complexType>
                    <xs:element type="xs:string" name="sunrise">
                      <xs:annotation>
                        <xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element type="xs:string" name="sunset">
                      <xs:annotation>
                        <xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="related_ehmi_stations">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="station" maxOccurs="unbounded" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.phpFollowing data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element type="xs:string" name="name"/>
                          <xs:element type="xs:short" name="wmocode"/>
                          <xs:element type="xs:string" name="phenomenon"/>
                          <xs:element type="xs:float" name="visibility"/>
                          <xs:element type="xs:byte" name="precipitations"/>
                          <xs:element type="xs:float" name="airpressure"/>
                          <xs:element type="xs:byte" name="relativehumidity"/>
                          <xs:element type="xs:float" name="airtemperature"/>
                          <xs:element type="xs:short" name="winddirection"/>
                          <xs:element type="xs:float" name="windspeed"/>
                          <xs:element type="xs:float" name="windspeedmax"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
       </xs:sequence>
      <xs:attribute type="xs:string" name="start_date"/>
      <xs:attribute type="xs:string" name="end_date"/>
    </xs:complexType>
   </xs:element>
</xs:schema>
</xs:schema>




Line 250: Line 302:
===XSLT 1===
===XSLT 1===
XSLT => HTML
XSLT => HTML
<source lang="xml">
<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"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="urn:schemas-microsoft-com:xslt ">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>Ilmajaamad</title>
            </head>
            <body>
                <h1>YAWS Ilmajaamad</h1>
                <xsl:for-each select="/records/record">
                    <ul>
                    <h2>
                        Ilmajaama kasutaja:
                        <xsl:value-of select="username"/>
                    </h2>
                        <ul>
                    <h3>
                        Asukoht:
                        <xsl:value-of select="location/aadress"/>
                    </h3>
                    <h3>
                        Andmed:
                    </h3>
                <ul>
                    <table border="1">
                    <tr bgcolor="#9acd32">
                        <th>Õhurõhk</th>
                        <th>Niiskus</th>
                        <th>Temperatuur</th>
                        <th>Tuule suund</th>
                        <th>Tuule kiirus</th>
                    </tr>
                        <xsl:for-each select="values">
                            <td><xsl:value-of select="concat(airpressure,' ', airpressure/@unit)"/></td>
                            <td><xsl:value-of select="concat(relativehumidity,' ', relativehumidity/@unit)"/></td>
                            <td><xsl:value-of select="concat(airtemperature/value,' ', airtemperature/@unit)"/></td>
                            <td><xsl:value-of select="concat(winddirection,' ', winddirection/@unit)"/></td>
                            <td><xsl:value-of select="concat(windspeed/value,' ', windspeed/@unit)"/></td>
                        </xsl:for-each>
                    </table>
                </ul>
                    <h4>
                    Seotud EMHI ilmajaamad:
                    </h4>
                    <ul>
                    <table border="1">
                        <tr bgcolor="#9acd32">
                            <th>Asukoht</th>
                            <th>Nähtavus</th>
                            <th>Õhurõhk</th>
                            <th>Niiskus</th>
                            <th>Temperatuur</th>
                            <th>Tuule suund</th>
                            <th>Tuule kiirus</th>
                        </tr>
                        <xsl:for-each select="related_ehmi_stations">
                            <xsl:for-each select="station">
                                <tr>
                                    <td><xsl:value-of select="name"/></td>
                                    <td><xsl:value-of select="visibility"/></td>
                                    <td><xsl:value-of select="airpressure"/></td>
                                    <td><xsl:value-of select="relativehumidity"/></td>
                                    <td><xsl:value-of select="airtemperature"/></td>
                                    <td><xsl:value-of select="winddirection"/></td>
                                    <td><xsl:value-of select="windspeed"/></td>
                                </tr>
                            </xsl:for-each>
                        </xsl:for-each>
                    </table>
                        </ul>
                    </ul>
                    </ul>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
</source>


===XSLT 2===
===XSLT 2===
XSLT => XML
XSLT => XML
<source lang="xml">
<?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="xml" indent="yes"/>
    <xsl:template  match="*">
        <stations>
        <xsl:for-each select="/records/record">
            <station>
            <station_location>
            <xsl:value-of select="concat(normalize-space(location/geo/lat),',',normalize-space(location/geo/long))"/>
            </station_location>
            <xsl:for-each select="values">
                <airpressure><xsl:value-of select="concat(airpressure,' ', airpressure/@unit)"/></airpressure>
                <relativehumidity><xsl:value-of select="concat(relativehumidity,' ', relativehumidity/@unit)"/></relativehumidity>
                <relativehumidity><xsl:value-of select="concat(airtemperature/value,' ', airtemperature/@unit)"/></relativehumidity>
                <relativehumidity><xsl:value-of select="concat(relativehumidity,' ', winddirection/@unit)"/></relativehumidity>
                <windspeed><xsl:value-of select="concat(windspeed/value,' ', windspeed/@unit)"/></windspeed>
            </xsl:for-each>
            </station>
        </xsl:for-each>
        </stations>
    </xsl:template>
</xsl:stylesheet>
</source>


=Retsensioonid=
=Retsensioonid=

Latest revision as of 00:03, 21 March 2017

Meeskond

  • Andres Kepler

Idee

Luua ilmajaama veebiteenus.

Vajalikud komponendid:

  • REST teenus
  • REST Teenuse kliendiks on RPi(2|3) W10, mis teeb sensori (SparkFun Weather Shield) andmetega XML POST päringuid REST teenuse suunas
  • Presentatsiooni kiht, mis visualiseerib REST'i andmed.
  • Presenteerivaks seadmeks on tavaarvuti või RPI3 7" W10'ga

Projekt

Ülesanne

  • Tuvastatud kasutaja saab ilmajaama andmedi lisada, kuvada ja kustutada
  • Tuvastatud kasutaja saab REST teenusega lisada andmebaasi ilmajaama andmedi.
  • Anonüümne ja tuvastatud kasutaja saab ilmajaama sensoriandmedi filtreerida asukoha ja perioodi järgi
  • Tuvastatud kasutajajid saab lisada gruppidesse (Riik, Maakond, Vald, Linn, Linnaosa)
  • Tuvastatud kasutaja andmeid saab muuta
  • Igal tuvastatud kasutajal on oma sensoriadnemetega "töölaud" (dashboard)
  • Tuvastatud kasutaja saab oma ilmajaama andmed (dashboard) anonüümselt jagada.


Blog

  • 17.03.2017 - YEInt'st saabus raudvara. RPi sai omale W10 peale.

XML

Teema

Ilmajaama andmed

XML

<?xml version="1.0" encoding="utf-8"?>
<records start_date="19.03.17" end_date="19.03.17" >
    <record>
        <username>andres@kepler.ee</username>
        <location>
            <!--Postal aadress-->
            <aadress>
                Jaama 33, Põlva, ESTONIA
            </aadress>
            <!--GPS cordinates-->
            <geo>
                <lat>
                    58.0608893
                </lat>
                <long>
                    27.067128399999998
                </long>
            </geo>
        </location>
        <values>
            <airpressure unit="hPa" > <![CDATA[1004.1]]></airpressure>
            <relativehumidity unit="%" ><![CDATA[87]]></relativehumidity>
            <airtemperature max="50.0" min="-50.0" unit="°C" >
                <value><![CDATA[-0.5]]></value>
                <max><![CDATA[50.0]]></max>
                <min><![CDATA[-5.5]]></min>
            </airtemperature>
            <winddirection property="winddirection" unit="°" ><![CDATA[207]]></winddirection>
            <windspeed max="36" min="0" unit="m/s">
                <value><![CDATA[0.5]]></value>
                <max><![CDATA[2.1]]></max>
            </windspeed>
            <!--Calculated values if GPS cordinates is set-->
            <sunrise><![CDATA[04:00]]></sunrise>
            <!--Calculated values if GPS cordinates is set-->
            <sunset ><![CDATA[02:00]]></sunset>

        </values>
        <related_ehmi_stations>
            <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
            <station>
                <name>Võru</name>
                <wmocode>26249</wmocode>
                <phenomenon>Variable clouds</phenomenon>
                <visibility>20.0</visibility>
                <precipitations>0</precipitations>
                <airpressure>1004.1</airpressure>
                <relativehumidity>87</relativehumidity>
                <airtemperature>-0.5</airtemperature>
                <winddirection>207</winddirection>
                <windspeed>0.5</windspeed>
                <windspeedmax>2.1</windspeedmax>
            </station>

            <station>
                <name>Valga</name>
                <wmocode>26247</wmocode>
                <phenomenon/>
                <visibility>23.0</visibility>
                <precipitations>0</precipitations>
                <airpressure>1004.4</airpressure>
                <relativehumidity>92</relativehumidity>
                <airtemperature>-1.4</airtemperature>
                <winddirection>203</winddirection>
                <windspeed>0.4</windspeed>
                <windspeedmax>1.8</windspeedmax>
            </station>

        </related_ehmi_stations>
    </record>


    <record>
        <username>jaan@gmail.com</username>
        <location>
            <!--Postal aadress-->
            <aadress/>
            <!--GPS cordinates-->
            <geo>
                <lat/>
                <long/>
            </geo>
        </location>
        <values>
            <airpressure unit="hPa" > <![CDATA[1004.1]]></airpressure>
            <relativehumidity unit="%" ><![CDATA[87]]></relativehumidity>
            <airtemperature max="50.0" min="-50.0" unit="°C" >
                <value><![CDATA[-0.5]]></value>
                <max><![CDATA[50.0]]></max>
                <min><![CDATA[-5.5]]></min>
            </airtemperature>
            <winddirection property="winddirection" unit="°" ><![CDATA[207]]></winddirection>
            <windspeed max="36" min="0" unit="m/s">
                <value><![CDATA[0.5]]></value>
                <max><![CDATA[2.1]]></max>
            </windspeed>
            <!--Calculated values if GPS cordinates is set-->
            <sunrise><![CDATA[04:00]]></sunrise>
            <!--Calculated values if GPS cordinates is set-->
            <sunset ><![CDATA[02:00]]></sunset>

        </values>
        <related_ehmi_stations>
            <!--Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php-->
            <station>
                <name>Võru</name>
                <wmocode>26249</wmocode>
                <phenomenon>Variable clouds</phenomenon>
                <visibility>20.0</visibility>
                <precipitations>0</precipitations>
                <airpressure>1004.1</airpressure>
                <relativehumidity>87</relativehumidity>
                <airtemperature>-0.5</airtemperature>
                <winddirection>207</winddirection>
                <windspeed>0.5</windspeed>
                <windspeedmax>2.1</windspeedmax>
            </station>


        </related_ehmi_stations>
    </record>
</records>

XML schema (XSD)

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="records">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="record" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="username"/>
              <xs:element name="location">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element type="xs:string" name="aadress">
                      <xs:annotation>
                        <xs:documentation>Postal aadressPostal aadress</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="geo">
                      <xs:annotation>
                        <xs:documentation>GPS cordinatesGPS cordinates</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element type="xs:string" name="lat"/>
                          <xs:element type="xs:string" name="long"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="values">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="airpressure">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:float">
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="relativehumidity">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:byte">
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="airtemperature">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element type="xs:float" name="value"/>
                          <xs:element type="xs:float" name="max"/>
                          <xs:element type="xs:float" name="min"/>
                        </xs:sequence>
                        <xs:attribute type="xs:float" name="max" use="optional"/>
                        <xs:attribute type="xs:float" name="min" use="optional"/>
                        <xs:attribute type="xs:string" name="unit" use="optional"/>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="winddirection">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:short">
                            <xs:attribute type="xs:string" name="property" use="optional"/>
                            <xs:attribute type="xs:string" name="unit" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="windspeed">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element type="xs:float" name="value"/>
                          <xs:element type="xs:float" name="max"/>
                        </xs:sequence>
                        <xs:attribute type="xs:byte" name="max" use="optional"/>
                        <xs:attribute type="xs:byte" name="min" use="optional"/>
                        <xs:attribute type="xs:string" name="unit" use="optional"/>
                      </xs:complexType>
                    </xs:element>
                    <xs:element type="xs:string" name="sunrise">
                      <xs:annotation>
                        <xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element type="xs:string" name="sunset">
                      <xs:annotation>
                        <xs:documentation>Calculated values if GPS cordinates is setCalculated values if GPS cordinates is set</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="related_ehmi_stations">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="station" maxOccurs="unbounded" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Following data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.phpFollowing data origin from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element type="xs:string" name="name"/>
                          <xs:element type="xs:short" name="wmocode"/>
                          <xs:element type="xs:string" name="phenomenon"/>
                          <xs:element type="xs:float" name="visibility"/>
                          <xs:element type="xs:byte" name="precipitations"/>
                          <xs:element type="xs:float" name="airpressure"/>
                          <xs:element type="xs:byte" name="relativehumidity"/>
                          <xs:element type="xs:float" name="airtemperature"/>
                          <xs:element type="xs:short" name="winddirection"/>
                          <xs:element type="xs:float" name="windspeed"/>
                          <xs:element type="xs:float" name="windspeedmax"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute type="xs:string" name="start_date"/>
      <xs:attribute type="xs:string" name="end_date"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

XSLT 1

XSLT => HTML

<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"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="urn:schemas-microsoft-com:xslt ">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>Ilmajaamad</title>
            </head>
            <body>
                <h1>YAWS Ilmajaamad</h1>

                <xsl:for-each select="/records/record">
                    <ul>
                    <h2>
                        Ilmajaama kasutaja:
                        <xsl:value-of select="username"/>
                    </h2>
                        <ul>
                    <h3>
                        Asukoht:

                        <xsl:value-of select="location/aadress"/>
                    </h3>

                    <h3>
                        Andmed:
                    </h3>

                <ul>
                    <table border="1">

                    <tr bgcolor="#9acd32">
                        <th>Õhurõhk</th>
                        <th>Niiskus</th>
                        <th>Temperatuur</th>
                        <th>Tuule suund</th>
                        <th>Tuule kiirus</th>
                    </tr>
                        <xsl:for-each select="values">
                            <td><xsl:value-of select="concat(airpressure,' ', airpressure/@unit)"/></td>
                            <td><xsl:value-of select="concat(relativehumidity,' ', relativehumidity/@unit)"/></td>
                            <td><xsl:value-of select="concat(airtemperature/value,' ', airtemperature/@unit)"/></td>
                            <td><xsl:value-of select="concat(winddirection,' ', winddirection/@unit)"/></td>
                            <td><xsl:value-of select="concat(windspeed/value,' ', windspeed/@unit)"/></td>

                        </xsl:for-each>

                    </table>
                </ul>

                    <h4>
                    Seotud EMHI ilmajaamad:
                    </h4>
                    <ul>
                    <table border="1">

                        <tr bgcolor="#9acd32">
                            <th>Asukoht</th>
                            <th>Nähtavus</th>
                            <th>Õhurõhk</th>
                            <th>Niiskus</th>
                            <th>Temperatuur</th>
                            <th>Tuule suund</th>
                            <th>Tuule kiirus</th>
                        </tr>

                        <xsl:for-each select="related_ehmi_stations">
                            <xsl:for-each select="station">
                                <tr>
                                    <td><xsl:value-of select="name"/></td>
                                    <td><xsl:value-of select="visibility"/></td>
                                    <td><xsl:value-of select="airpressure"/></td>
                                    <td><xsl:value-of select="relativehumidity"/></td>
                                    <td><xsl:value-of select="airtemperature"/></td>
                                    <td><xsl:value-of select="winddirection"/></td>
                                    <td><xsl:value-of select="windspeed"/></td>

                                </tr>


                            </xsl:for-each>

                        </xsl:for-each>
                    </table>
                        </ul>


                    </ul>
                    </ul>

                </xsl:for-each>



            </body>
        </html>


    </xsl:template>

</xsl:stylesheet>

XSLT 2

XSLT => XML


<?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="xml" indent="yes"/>
    <xsl:template  match="*">
        <stations>
        <xsl:for-each select="/records/record">
            <station>
            <station_location>
            <xsl:value-of select="concat(normalize-space(location/geo/lat),',',normalize-space(location/geo/long))"/>
            </station_location>

            <xsl:for-each select="values">

                <airpressure><xsl:value-of select="concat(airpressure,' ', airpressure/@unit)"/></airpressure>
                <relativehumidity><xsl:value-of select="concat(relativehumidity,' ', relativehumidity/@unit)"/></relativehumidity>
                <relativehumidity><xsl:value-of select="concat(airtemperature/value,' ', airtemperature/@unit)"/></relativehumidity>
                <relativehumidity><xsl:value-of select="concat(relativehumidity,' ', winddirection/@unit)"/></relativehumidity>
                <windspeed><xsl:value-of select="concat(windspeed/value,' ', windspeed/@unit)"/></windspeed>

            </xsl:for-each>

            </station>



        </xsl:for-each>

        </stations>

    </xsl:template>

</xsl:stylesheet>

Retsensioonid