본문 바로가기

수업자료

student_list

<?xml version="1.0" encoding="ks_c_5601-1987"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="html" indent="yes"/>
  <!--..................................................................-->
  <xsl:template match="/">
    <table cellpadding="0" cellspacing="0" border="1" align="center" style="width:900px; background-color:#CCCCCC">
      <xsl:call-template name="write_title" />
      <xsl:call-template name="write_heading" />
      <xsl:apply-templates select="students/student" />
    </table>
  </xsl:template>

  <xsl:template match="student" name="write_student">
    <tr style="height:25px; text-align:center; color:black; font-weight:bold; cursor:pointer" onClick="on_click('04612024')" onMouseOver="this.style.backgroundColor='#AAAAFF'" onMouseOut="this.style.backgroundColor=''">
      <td style="color:green"><xsl:value-of select="position()"/>      </td>
      <td><xsl:value-of select="name"/></td>
      <td><xsl:value-of select="@id"/></td>
      <td><xsl:value-of select="phone"/></td>
      <td><xsl:value-of select="addr"/></td>
    </tr>
  </xsl:template>

  <xsl:template name="write_heading">
    <tr style="height:30px; text-align:center; background-color:#CCCCFF; color:red; font-weight:bold">
      <td style="width:20%">no.</td>
      <td style="width:20%">이름</td>
      <td style="width:20%">학번</td>
      <td style="width:20%">전화</td>
      <td style="width:20%">주소</td>
    </tr>
  </xsl:template>

  <xsl:template name="write_title">
    <caption style="font-size:16pt; font-weight:bold">
      2010 XML수강 학생명단(<xsl:value-of select="count(students/student)"/>)
    </caption>
  </xsl:template>
 
  <!--..................................................................-->
  <xsl:template match="@* | node()">
      <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

'수업자료' 카테고리의 다른 글

student  (0) 2010.04.08
DOM  (0) 2010.04.08