<?xml version="1.0"?>
<!--////////////////////////////////////////////////////////////-->
<!--xmlMax template xsl file for presenting PDAToolbox databases-->
<!--(C) 2003 Erlend Thune, M.Sc.-->
<!--////////////////////////////////////////////////////////////-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40">
  <xsl:output method="html"/>
  <xsl:template match="/">
    <!--Print out the stylesheet header -->
    <xsl:element name="xsl:stylesheet">
      <xsl:attribute name="version">1.0</xsl:attribute>
      <xsl:text>
        <!--Linebreak-->
      </xsl:text>
      <xsl:variable name="appname">
        <xsl:choose>
          <xsl:when test="/applicationdescription/@outputname != ''">
            <xsl:value-of select="/applicationdescription/@outputname"/>
          </xsl:when>
          <xsl:otherwise>application</xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <!--The datebase node templates-->
      <xsl:for-each select="applicationdescription/db">
        <xsl:variable name="dbname">
          <xsl:choose>
            <xsl:when test="@outputname != ''">
              <xsl:value-of select="@outputname"/>
            </xsl:when>
            <xsl:otherwise>database</xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <!--We create a template for each db-->
        <xsl:text>
          <!--Linebreak-->
        </xsl:text>
        <xsl:element name="xsl:template">
          <xsl:attribute name="match">/<xsl:value-of select="$appname"/>/<xsl:value-of select="$dbname"/></xsl:attribute>
          <xsl:for-each select="record">
            <!--////////////////////////////////////////////////////// -->
            <!--We're outputting a table for each record definition.   -->
            <!--We make a header with the output name of the record. -->
            <!--////////////////////////////////////////////////////// -->
            <!--Must know which record name we should match-->
            <xsl:variable name="recordname">
              <xsl:choose>
                <xsl:when test="@outputname != ''">
                  <xsl:value-of select="@outputname"/>
                </xsl:when>
                <xsl:otherwise>record</xsl:otherwise>
              </xsl:choose>
            </xsl:variable>
            <xsl:text>
              <!--Linebreak-->
            </xsl:text>

<b>Hello, this file has been generated for your PDAToolbox application. You should modify it such
that the field names are correct.</b>          
            <!--Print out the header for a table-->
            <h1>
              <xsl:value-of select="$recordname"/>
            </h1>
            <xsl:text>
              <!--Linebreak-->
            </xsl:text>
            <table>
              <!--table header-->
              <xsl:text>
                <!--Linebreak-->
              </xsl:text>
              <tr>
                <!--Background color of table header-->
                <xsl:attribute name="bgcolor">#0e9fee</xsl:attribute>
                <!--Field headers-->
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <xsl:comment>Copy/paste such that you have one &lt;th&gt; element for each field in the database.</xsl:comment>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Text</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Numeric</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Date</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Time</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Alarm</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <th>Checkbox</th>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
              </tr>
              <!--Table rows-->
              <xsl:text>
                <!--Linebreak-->
              </xsl:text>
              <xsl:element name="xsl:for-each">
                <xsl:attribute name="select"><xsl:value-of select="$recordname"/></xsl:attribute>
                <xsl:text>
                  <!--Linebreak-->
                </xsl:text>
                <tr>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <!--Make the rows appear with different background color-->
                  <xsl:element name="xsl:if">
                    <xsl:attribute name="test">position() mod 2 = 0</xsl:attribute>
                    <xsl:text>
                      <!--Linebreak-->
                    </xsl:text>
                    <xsl:element name="xsl:attribute">
                      <xsl:attribute name="name">bgcolor</xsl:attribute>#f0f0f0</xsl:element>
                  </xsl:element>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <xsl:element name="xsl:if">
                    <xsl:attribute name="test">position() mod 2 = 1</xsl:attribute>
                    <xsl:text>
                      <!--Linebreak-->
                    </xsl:text>
                    <xsl:element name="xsl:attribute">
                      <xsl:attribute name="name">bgcolor</xsl:attribute>#e0e0e0</xsl:element>
                  </xsl:element>
                  <!--Fields-->
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <xsl:comment>Copy/paste such that you have one &lt;td&gt; element for each field in the database.
The field names are the ones you have defined in your PDAToolbox environment.                  
                  </xsl:comment>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Loca</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Nume</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Date</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Time</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Alar</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                  <td><xsl:element name="xsl:value-of"><xsl:attribute name="select">Chec</xsl:attribute></xsl:element></td>
                  <xsl:text>
                    <!--Linebreak-->
                  </xsl:text>
                </tr>
              </xsl:element>
            </table>
            <!--End table definition. One for each record definition-->
          </xsl:for-each>
        </xsl:element>
        <!--end database template element-->
      </xsl:for-each>
      <!--end for each db -->
    </xsl:element>
    <!--endof generated stylesheet-->
  </xsl:template>
</xsl:stylesheet>
