<?xml version="1.0" encoding="ISO-8859-1"?>


<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output method="xml" version="1.0"
encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
  <html>
  <body>
    The weather at our house
    <xsl:value-of select='format-dateTime(adjust-dateTime-to-timezone(/station/system/datetime),"[FNn], [D1o] [MNn] [Y0001] at [H01]:[m01]:[s01]")'/>
    <xsl:value-of select='format-dateTime(/station/system/datetime, "([H01]:[m01]:[s01] UTC)")'/>:
    <br/>
    <xsl:if test='/station/sensor[@name="rain"]/rain[@name="current"] > 0'>It is raining! Current rate: <xsl:value-of select='/station/sensor[@name="rain"]/rain[@name="current"]'/> mm/hour
    <br/>
    </xsl:if>
    <xsl:if test="/station/sensor[@name='rain']/rain[@name='total']/text() - document('midnight_rain.xml')/rain[@name='total']">
    Rain today <xsl:value-of select='format-number(/station/sensor[@name="rain"]/rain[@name="total"]/text() - document("midnight_rain.xml")/rain[@name="total"], "#.0")'/> mm
    <br/>
    </xsl:if>
    Wind <xsl:value-of select='/station/sensor[@name="wind"]/winddirection'/>&#160;<xsl:value-of select='/station/sensor[@name="wind"]/winddirection/@unit'/> at
    <xsl:value-of select='format-number(/station/sensor[@name="wind"]/windvelocity[@name="gust"]*1.9438449, "#.0")'/>&#160;Knots
    averaging <xsl:value-of select='format-number(/station/sensor[@name="wind"]/windvelocity[@name="average"]*1.9438449, "#.0")'/>&#160;Knots
    <br/>
    Temperature is <xsl:value-of select='/station/sensor[@name="thermohygro"][@type="outdoor"]/temperature[@name="temperature"]'/>&#xB0;C
    (<xsl:value-of select='format-number(/station/sensor[@name="thermohygro"][@type="outdoor"]/temperature[@name="temperature"]* 9 div 5 + 32, "#.0")'/>&#176;F)
    <br/>
    Dewpoint is <xsl:value-of select='/station/sensor[@name="thermohygro"][@type="outdoor"]/temperature[@name="dewpoint"]'/>&#176;C
    , windchill <xsl:value-of select='/station/sensor[@name="wind"]/temperature[@name="windchill"]'/>&#176;C
    (<xsl:value-of select='format-number(/station/sensor[@name="wind"]/temperature[@name="windchill"]*9 div 5 + 32, "#.0")'/>&#176;F),
    <br/>
    and the relative humidity is <xsl:value-of select='/station/sensor[@name="thermohygro"][@type="outdoor"]/humidity'/>%
    <br/>
    Sealevel pressure is <xsl:value-of select='/station/sensor[@name="barothermohygro"]/pressure[@name="sealevel"]'/>&#160;<xsl:value-of select='/station/sensor[@name="barothermohygro"]/pressure[@name="sealevel"]/@unit'/>
    <br/>
    The Troest supercomputer forecasts: <xsl:value-of select='/station/sensor[@name="barothermohygro"]/forecast'/>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>
