XML asd
<?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><XML 연습></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>< 성적 ></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>