<?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="1" cellpadding="2">
      <xsl:apply-templates select="/forum_home/Category"></xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="/forum_home/Category">
    <tr  style="height:32px;background:#add8e6;">
      <td colspan="5">
        <b>
            <xsl:value-of select="CatName"></xsl:value-of>
        </b>
      </td>
    </tr>
    <tr style="background:#E7EBF7;height:22px;text-align:center;">
      <td style="text-align:center;width:5%;">
        -
      </td>
      <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>
  </xsl:template>

  <xsl:template match="Forum">
    <tr>
      <td style="text-align:center;">
        <img>
          <xsl:attribute name="src">
            images/folder.gif
          </xsl:attribute>
        </img>
      </td>
      <td>
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="link"></xsl:value-of>
          </xsl:attribute>
          <xsl:value-of select="Name"></xsl:value-of>
        </a>
        <br/>
        <xsl:value-of select="Description"></xsl:value-of>
      </td>
      <td>
        <xsl:if test="UserName!=''">
          <a>
            <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>

