<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:include href="/app/tools/support/templates/layout.xsl" />

  <xsl:template name="mainBody" >
    <xsl:call-template name="bodyTitle" >
      <xsl:with-param name="title">Services</xsl:with-param>
    </xsl:call-template>
    <xsl:call-template name="displayList" />
  </xsl:template>

  <xsl:template name="displayList" >

    <xsl:choose>

      <xsl:when test="Collection/Service">
        <xsl:call-template name="displayListBody" />
      </xsl:when>

      <xsl:otherwise>
        <xsl:call-template name="collectionListEmpty" />
      </xsl:otherwise>

    </xsl:choose>

  </xsl:template>

  <xsl:template name="displayListBody" >
    <xsl:call-template name="displayServiceList" />
  </xsl:template>

  <xsl:template name="displayServiceList" >
    <table class="dataset">
      <tbody>
        <tr class="header">
          <th>ID</th>
          <th>Service Name</th>
          <th>Clean Name</th>
        </tr>

        <xsl:for-each select="Collection/Service" >
          <!--<xsl:sort select="ServiceID" data-type="number" />-->
          <xsl:call-template name="displayServiceRow" />
        </xsl:for-each>
      </tbody>
    </table>
  </xsl:template>

  <xsl:template name="displayServiceRow" >
    <tr class="row{position() mod 2}">
      <td><xsl:value-of select="ServiceID" /></td>
      <td><xsl:value-of select="ServiceName" /></td>
      <td><xsl:value-of select="ServiceNameClean" /></td>
    </tr>
  </xsl:template>

</xsl:stylesheet>
