<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <table width="100%" style="border-collapse:collapse;border:1px solid #b7b7b7;" cellpadding="6" cellspacing="0">
      <tr style="background:#276B84;text-align:center;color:#ffffff;">
        <td style="text-align:center;width:5%;" background="/forum/template/ddth/category.gif">
        </td>
        <td style="width:45%;" background="/forum/template/ddth/category.gif">
          <b>Diễn đàn</b>
        </td>
        <td style="width:40%;" background="/forum/template/ddth/category.gif">
          <b>Bài mới nhất</b>
        </td>
        <td style="width:5%;" background="/forum/template/ddth/category.gif">
          #
        </td>
        <td style="width:5%;" background="/forum/template/ddth/category.gif">
          #
        </td>
      </tr>
      <xsl:apply-templates select="/forum_home/Category"></xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="/forum_home/Category">
    <tr style="background:#276B84;">
      <td  colspan="5" background="/forum/template/ddth/category.gif" style="padding-left:10px;color:#ffffff;">
        <b>
            <xsl:value-of select="CatName"></xsl:value-of>
        </b>
      </td>
    </tr>
    
    <xsl:apply-templates select="Forum"></xsl:apply-templates>
  </xsl:template>

  <xsl:template match="Forum">
    <tr>
      <td style="text-align:center;">
        <img src="/forum/template/ddth/forum.gif"/>
      </td>
      <td  style="background-color:#f9f9f9;">
        <a style="color:#276B84;">
          <xsl:attribute name="href">
            <xsl:value-of select="link"></xsl:value-of>
          </xsl:attribute>
          <b>
            <xsl:value-of select="Name"></xsl:value-of>
          </b>
        </a>
        <br/>
        <xsl:value-of select="Description"></xsl:value-of>
      </td>
      <td>
        <xsl:if test="UserName!=''">
          <a style="color:#276B84;">
            <xsl:attribute name="href">
              <xsl:value-of select="topic_url"></xsl:value-of>
            </xsl:attribute>
            <xsl:value-of select="TopicName"></xsl:value-of>
          </a>
          <br />
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="mem_url"></xsl:value-of>
            </xsl:attribute>
            <b>
              <xsl:value-of select="UserName"></xsl:value-of>
            </b>
          </a>
          (<xsl:value-of select="PostedDate"></xsl:value-of>)
        </xsl:if>
      </td>
      <td style="text-align:center;">
        <xsl:value-of select="TotalTopic"></xsl:value-of>
      </td>
      <td style="text-align:center;">
        <xsl:value-of select="TotalReply"></xsl:value-of>
      </td>
    </tr>
  </xsl:template>
    
</xsl:stylesheet>

