<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:specter="urn:specter-instruments">
  <xsl:output method="html" />
  <ms:script language="C#" implements-prefix="specter">
    <![CDATA[              
         public string localTime(String str)
         {
      DateTime dt = DateTime.Parse(str);
            return dt.ToLocalTime().ToString("T");
         }
    ]]>
  </ms:script>
<xsl:template match="/">
  <html>
    <head>
      <title>WIN-911 Alert</title>
    </head>
    <body>
      <table style="width: 100%; background-color: #FFFFFF; color: #000000; font-family: &#39;Segoe UI&#39;, Helvetica, sans-serif;">
      <tbody>
        <tr>
          <td style="padding-left: 36px;">
            <table style="font-family: &#39;Segoe UI&#39;, Helvetica, sans-serif; width: 80%; border-style: none; color: #000000;">
              <tbody>
                <tr>
                  <td>
                  <div style="padding-right: 12px; font-size: 24pt; color: #CE1E24;">WIN-911 Alert </div>
                    <xsl:value-of select="NotificationEvent/AlarmEvent/Alarm/Area"/> : <xsl:value-of select="NotificationEvent/AlarmEvent/Alarm/Name"/> : <xsl:value-of select="NotificationEvent/AlarmEvent/Condition/Name"/> is...
                  </td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
        <tr>
          <td style="padding-left: 36px; padding-bottom: 12px;">
          <table style="font-family: &#39;Segoe UI&#39;, Helvetica, sans-serif; font-size: 16pt; text-align: center; border-style: none; border-collapse: collapse; width: 80%;">
             <tbody>
             <tr>
              <td><xsl:attribute name="style">width: 50%; padding: 12px 0px 12px 0px; color: white; background-color:
                  <xsl:choose><xsl:when test="NotificationEvent/AlarmEvent/State/IsActive = &#39;true&#39;">red;</xsl:when>
                  <xsl:otherwise>#000000;</xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:choose>
                  <xsl:when test="NotificationEvent/AlarmEvent/State/IsActive = &#39;true&#39;">ACTIVE</xsl:when>
                  <xsl:otherwise>INACTIVE</xsl:otherwise>
                </xsl:choose>
              </td><td style="width: 12px;"></td>
              <td><xsl:attribute name="style">padding: 12px 0px 12px 0px; color: white; background-color:
                  <xsl:choose><xsl:when test="NotificationEvent/AlarmEvent/State/IsAcked = &#39;true&#39;">#000000;</xsl:when>
                  <xsl:otherwise>red;</xsl:otherwise>
                  </xsl:choose>
                </xsl:attribute>
                <xsl:choose>
                  <xsl:when test="NotificationEvent/AlarmEvent/State/IsAcked = &#39;true&#39;">ACKED</xsl:when>
                  <xsl:otherwise>UNACKED</xsl:otherwise>
                </xsl:choose>
              </td>
             </tr>
             </tbody>
             </table>
          </td>
        </tr>
        <tr>
          <td style="padding: 0px 0px 12px 36px;">
            <table style="font-family: &#39;Segoe UI&#39;, Helvetica, sans-serif; width: 80%; border-style: none; border-collapse: collapse; background-color: #FFFFFF; color: #000">
              <thead>
                <tr>
                  <th colspan="2" style=" background-color: #CCCCCC; color: #000000; padding: 6px 12px; text-align: left; font-size: 12pt; font-weight: normal;">Alarm Details</th>
                </tr>
              </thead>
              <tbody>                <tr>                  <td style="padding-left: 12px; width: 14em; ">Description: </td><td><xsl:value-of select="NotificationEvent/AlarmEvent/Condition/Description"/></td>                </tr>
                <tr>
                  <td style="padding-left: 12px; width: 14em; ">Condition Name: </td><td><xsl:value-of select="NotificationEvent/AlarmEvent/Condition/Name"/></td>
                </tr>                <tr>                  <td style="padding-left: 12px; width: 14em; ">Active Time: </td><td><xsl:value-of select="specter:localTime(NotificationEvent/AlarmEvent/ActiveTime)"/></td>                </tr>
                <xsl:if test="NotificationEvent/AlarmEvent/State/IsAcked = &#39;true&#39;">
                <tr>
                  <td style="padding-left: 12px; width: 14em; ">Acked By: </td><td><xsl:value-of select="NotificationEvent/AlarmEvent/Actor"/></td>
                </tr>
                <tr>
                  <td style="padding: 0px 0px 12px 12px; width: 14em; ">Comment: </td><td style="padding: 0px 0px 12px 0px;"><xsl:value-of select="NotificationEvent/AlarmEvent/Comment"/></td>
                </tr>
                </xsl:if>
              </tbody>
            </table>
          </td>
        </tr>
      </tbody>
      </table>
    </body>
  </html>
</xsl:template>
</xsl:stylesheet>