목록으로 2012.11.30. 14:35
XML

asd

youtube

<?xml version="1.0" encoding="euc-kr" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<html>
 <head>
  <title>&lt;XML 연습&gt;</title>
 </head>
 <body>
 <center>
 <xsl:variable name="bCount" select="count(//학생)"/>
 <xsl:variable name="kSum" select="sum(//국어)"/>
 <xsl:variable name="eSum" select="sum(//영어)"/>
 <xsl:variable name="mSum" select="sum(//수학)"/>
 <xsl:variable name="bTotal" select="$kSum+$eSum+$mSum"/>
 <xsl:variable name="bAve" select="$bTotal div $bCount"/>

  <h1>&lt; 성적 &gt;</h1>
  <hr/>
 
 <table border="1">
  <tr>
   <th bgcolor="green" rowspan="2"><font color="white"> 순번</font></th>
   <th bgcolor="green" rowspan="2"><font color="white"> 이름</font></th>
   <th bgcolor="green" colspan="3"><font color="white"> 성적</font></th>
   <th bgcolor="green" rowspan="2"><font color="white"> 총점</font></th>
   <th bgcolor="green" rowspan="2"><font color="white"> 평균</font></th>
  </tr>
  <tr>
   <th bgcolor="rgb(100,170,0)"><font color="white"> 국어</font></th>
   <th bgcolor="rgb(100,170,0)"><font color="white"> 영어</font></th>
   <th bgcolor="rgb(100,170,0)"><font color="white"> 수학</font></th>
  </tr>
   <xsl:apply-templates select="성적/학생"/>
   <tr>
    <td align="center" colspan="2">과목별총점</td>
    <td align="center" colspan="1"><xsl:value-of select="$kSum"/></td>
    <td align="center" colspan="1"><xsl:value-of select="$eSum"/></td>
    <td align="center" colspan="1"><xsl:value-of select="$mSum"/></td>
    <td align="center" colspan="1"><xsl:value-of select="$bTotal"/></td>
    <td align="center" colspan="1"><xsl:value-of select="$bAve"/></td>
   </tr>

   </table>
   </center>
 </body>
 </html>
</xsl:template>

<xsl:template match="학생">
<xsl:variable name="bHap" select="국어+영어+수학"/>
<xsl:variable name="bAv" select="국어+영어+수학 div 3"/>
  <tr>
  <!--<xsl:value-of select="position()/>-->
   <td align="center"><xsl:number/></td>
   <td align="center"><xsl:value-of select="이름"/></td>
   <td align="center"><xsl:value-of select="국어"/></td>
   <td align="center"><xsl:value-of select="영어"/></td>
   <td align="center"><xsl:value-of select="수학"/></td>
   <td align="right"><xsl:value-of select="$bHap"/></td>
   <td align="center"><xsl:value-of select="format-number($bAv, '###.0')"/></td>
  </tr>
</xsl:template>
</xsl:stylesheet>

댓글 0

댓글 작성 권한이 없습니다. 로그인하기

NO
TITLE
섬네일
JSP
1 | 10. 18 | 조회
118
JSP 1
| 11. 27 | 조회
116
XML
dqw | 11. 23 | 조회
114
XML 124
XML
124 | 11. 23 | 조회
113
XML 124
C언어
profile 너에게제공 | 03. 28 | 조회
112
C언어 3-28
6 | 10. 11 | 조회
110
8 | 10. 11 | 조회
109
JSP
9 | 10. 18 | 조회
108
JSP 9
C언어
profile 너에게제공 | 11. 29 | 조회
107
C언어 A
profile 너에게제공 | 10. 04 | 조회
106
C언어
asf | 11. 23 | 조회
105
C언어 af
profile 너에게제공 | 04. 10 | 조회
104