<?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%" cellpadding="0" cellspacing="0">
      <xsl:apply-templates select="/forum_home/Category"></xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="/forum_home/Category">
    <tr>
      <td>
        <table width="100%" style="border-collapse:collapse;border-color:#B8D7F3;" border="1" cellpadding="4" cellspacing="0">
          <tr  style="height:32px; background: url(/forum/template/communityserver/header_bg.jpg) repeat-x scroll left top ;color:white;">
            <td colspan="4">
              <b>
                <xsl:value-of select="CatName"></xsl:value-of>
              </b>
            </td>
          </tr>
          <tr style="background:#EEEEEE;text-align:center;color:#60625F;">
            <td style="width:45%;">
              <b>Diễn đàn</b>
            </td>
            <td style="width:40%;">
              <b>Bài mới nhất</b>
            </td>
            <td style="width:5%;">
              <b>Chủ đề</b>
            </td>
            <td style="width:5%;">
              <b>Bài</b>
            </td>
          </tr>
          <xsl:apply-templates select="Forum"></xsl:apply-templates>
        </table>
      </td>
    </tr>
    <tr>
      <td style="height:16px;"></td>
    </tr>
  </xsl:template>

  <xsl:template match="Forum">
    <tr>
      <td>
        <table cellpadding="4" cellspacing="0">
          <tr>
            <td valign="top">
              <a>
                <xsl:attribute name="href">
                  <xsl:value-of select="link"></xsl:value-of>
                </xsl:attribute>
                <img src="/forum/template/communityserver/forum_moderated.png" border="0"/>
              </a>
            </td>
            <td valign="top">
              <a style="color:#617D78">
                <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>
          </tr>
        </table>
      </td>
      <td>
        <xsl:if test="UserName!=''">
          <a style="color:#617D78">
            <xsl:attribute name="href">
              <xsl:value-of select="topic_url"></xsl:value-of>
            </xsl:attribute>
            <b>
              <xsl:value-of select="TopicName"></xsl:value-of>
            </b>
          </a>
          <br />
          <a style="color:#617D78">
            <xsl:attribute name="href">
              <xsl:value-of select="mem_url"></xsl:value-of>
            </xsl:attribute>
              <xsl:value-of select="UserName"></xsl:value-of>
          </a>
          <br/>
          <b>
            <i>
              <xsl:value-of select="PostedDate"></xsl:value-of>
            </i>
          </b>
        </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>

