<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" indent="yes" method="html"/>
<xsl:template match="swd">
  <html>

  <body>
    <font size="4"><b>Current Active Regions on the Sun</b></font>
    <table>
      <tr><th>NOAA Region</th><th>Longitude</th><th>Latitude</th><th>Area</th><th>Number Sunspots</th><th>Magnetic Config</th></tr>
      <xsl:apply-templates/>
    </table>
    * Indicates region is a plage
  </body>
  </html>
</xsl:template>

<xsl:template match="region">
<tr>
  <td><xsl:value-of select="@rgn"/>
  <xsl:if test="@plage='true'">*</xsl:if>
  </td>
  <xsl:call-template name="displayCoordinate">
  <xsl:with-param name="lon" select="@lon"/>
  <xsl:with-param name="lat" select="@lat"/>
  </xsl:call-template>
  <td><xsl:value-of select="@area"/></td>
  <td><xsl:value-of select="@spots"/></td>
  <td><xsl:value-of select="@mag"/></td>
</tr>
</xsl:template>

<xsl:template name="displayCoordinate">
<xsl:param name="lon"/>
<xsl:param name="lat"/>
<td><xsl:value-of select="format-number($lon,'#0.0')"/></td>
<td><xsl:value-of select="format-number($lat,'#0.0')"/></td>
</xsl:template>

</xsl:stylesheet>

 
