<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="Rows">4</xsl:param>
  <xsl:template match="paperList">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <link href="resource/css.css" rel="stylesheet" type="text/css" />
        <style>
          body{
          margin: 0px;
          }
          table{font-size:12px}
          img.paperImg{
          height: 150px;
          width: 120px;
          }
          img.paperImg1{
          height: 150px;
          width: 120px;
          cursor: hand;
          filter: Alpha(Opacity=30, FinishOpacity=80, Style=0, StartX=0, StartY=0, FinishX=120, FinishY=150);
          }
          td.paperImgBorder{
          height: 160px;
          width: 130px;
          border: 1px solid #9FCAFF;
          text-align: center;
          vertical-align: middle;
          }
          td.paperDate{
          color: #FB7802;
          text-indent: 10px;
          }
          td.paperSize{
          color: #15589C;
          text-indent: 10px;
          }

          input.BtnMouseout,input.BtnMouseover{
          border:0px;
          background-image: url(resource/image/Btn_bkgrd1.png);
          font-size: 12px;
          padding-right: 5px;
          padding-left: 5px;
          text-align: center;
          height: 21px;
          width: 55px;
          }
          input.BtnMouseover{
          border:0px;
          background-image: url("resource/image/Btn_bkgrd2.png");
          cursor: hand;
          }
          td.title {
          }
        </style>
        <script>
          function ReadPaper(paperID, date)
          {
          external.ReadPaper(paperID, date);
          }

          function RemovePaper(paperID, date)
          {
          external.RemovePaper(paperID, date);
          }
        </script>
      </head>
      <body  style="overflow:auto">
        <table width="100%" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <table width="100%" cellpadding="0" cellspacing="0"  background="resource/image/hengtiao-zhong.png">
                <tr>
                  <td>
                    <img src="resource/image/hengtiao-zuo.png" />
                  </td>
                  <td width="100%">
                    <table width="100%">
                      <tr align="left">
                        <td class="blue2">
                          我的报刊:
                        </td>
                        <td></td>
                      </tr>
                    </table>
                  </td>
                  <td>
                    <img src="resource/image/hengtiao-you.png"/>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <table border="0" width="90%" align="center">
                <xsl:apply-templates select="item[position() mod $Rows = 1]"/>
              </table>
            </td>
          </tr>
        </table>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="item">
    <tr align="center">
      <xsl:for-each select=".|following-sibling::item[position() &lt; $Rows]">
        <xsl:variable name="fileSize" select="fileList/item[1]/filesize" />
        <xsl:variable name="date" select="fileList/item[1]/date" />
        <xsl:variable name="previewImg" select="fileList/item[1]/previewImg" />
        <td>
          <table border="0" width="100%" align="center">
            <tr>
              <td>
                <table>
                  <tr>
                    <td  class="paperImgBorder">
                      <img class="paperImg" width="150" height="150" onMouseOut="this.className='paperImg'" onMouseOver="this.className='paperImg1'">
                        <xsl:attribute name="src">
                          <xsl:value-of select="$previewImg"/>
                        </xsl:attribute>
                        <xsl:if test="string-length($previewImg) = 0">
                          <xsl:attribute name="src">
                            DefaultPrev.png
                          </xsl:attribute>
                        </xsl:if>
                        <xsl:attribute name="onclick">
                          ReadPaper('<xsl:value-of select="paperID"/>','<xsl:value-of select="$date"/>');
                        </xsl:attribute>
                      </img>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
            <tr>
              <td class="blue2">
                <xsl:value-of select="paperName"/>
              </td>
            </tr>
            <tr>
              <td class="orange2">
                期号:<xsl:value-of select="$date"/>
              </td>
            </tr>
            <tr>
              <td class="blue1">大小：
                <xsl:value-of select="format-number($fileSize div 1048576,'###,###.00')"/>
                <xsl:text> </xsl:text> MB
              </td>
            </tr>
            <tr>
              <td>
                <input class ="BtnMouseout" type="button" value="阅读" hidefocus="true" onMouseOut="this.className='BtnMouseout'" onMouseOver="this.className='BtnMouseover'">
                  <xsl:attribute name="onclick">
                    ReadPaper('<xsl:value-of select="paperID"/>','<xsl:value-of select="$date"/>');
                  </xsl:attribute>
                </input>
                <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
                <input class ="BtnMouseout" type="button" value="删除" hidefocus="true" onMouseOut="this.className='BtnMouseout'" onMouseOver="this.className='BtnMouseover'">
                  <xsl:attribute name="onclick">
                    RemovePaper('<xsl:value-of select="paperID"/>','<xsl:value-of select="$date"/>');
                  </xsl:attribute>
                </input>
              </td>
            </tr>
          </table>
        </td>
      </xsl:for-each>
    </tr>
  </xsl:template>
</xsl:stylesheet>
