Jaamade koordinaadid koos õhutemperatuuriga HTML-i XSLT abil

From ICO wiki
Revision as of 18:08, 2 April 2012 by Rkalamee (talk | contribs) (Created page with '<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-c…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
<?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="/">
      <!-- XML dokumendid muutujatena--> 
          <xsl:variable name="emhi" select="document('http://www.emhi.ee/ilma_andmed/xml/observations.php')"/>
          <xsl:variable name="gps" select="document('jaamad_koordinaadid.xml')"/>
      <html>
        
        <head>
          <title>Temperatuurid</title>
        </head>
        
        <body>
          
          <table>
            
            <tr>
              
              <td>
                <b>Jaam</b>
              </td>
              <td>
                <b>Laiuskraadid</b>
              </td>
              <td>
                <b>Laiusminutid</b>
              </td>
              <td>
                <b>Laiussekundid</b>
              </td>
              <td>
                <b>Pikkuskraadid</b>
              </td>
              <td>
                <b>Pikkusminutid</b>
              </td>
              <td>
                <b>Pikkussekundid</b>
              </td>
              <td>
                <b>Õhutemperatuur</b>
              </td>
            </tr>
            <xsl:for-each select="$emhi//station">
              <tr>
                <!-- teeme muutuja, mis jätab meelde jaama nime -->
                <xsl:variable name="jnimi" select="name"></xsl:variable>
                <td>
                  <xsl:value-of select="$jnimi"/>
                </td>
                <!-- otsime jnimi nimega jaama laiuskraadide kraadid -->
                <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/laius/kraad"/>
                </td>
                <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/laius/minut"/>
                </td>
                 <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/laius/sekund"/>
                </td>
                <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/pikkus/kraad"/>
                </td>
                <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/pikkus/minut"/>
                </td>
                <td>
                  <xsl:value-of select="$gps//jaam[contains(nimi,$jnimi)]/asukoht/pikkus/sekund"/>
                </td>
                <td>
                  <xsl:value-of select="airtemperature"/>
                </td>
              </tr>
            </xsl:for-each>
          </table>
        </body>
      </html>
    </xsl:template>
</xsl:stylesheet>