XML 124
<?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>XSL 연습 </title></head>
<body>
<center>
<xsl:variable name="bCount" select="count(//회원)"/>
<xsl:variable name="bTotal" select="sum(//월저축액)"/>
<xsl:variable name="bAverage" select="$bTotal div $bCount"/>
<h1> 주 소 록 </h1>
<hr/>
<table border="1">
<tr>
<th bgcolor="ssee11" rowspan="2"> 번호 </th>
<th bgcolor="wwee22" rowspan="2"> 이름 </th>
<th bgcolor="rree33" rowspan="2"> 생년월일 </th>
<th bgcolor="ggee44" colspan="2"> 연락처 </th>
<th bgcolor="ffee55" rowspan="2"> 월저축액 </th>
<th bgcolor="ffee22" rowspan="2"> 나이 </th>
</tr>
<tr>
<th bgcolor="eegg01"> 전화번호</th>
<th bgcolor="eegg22"> 주소</th>
</tr>
<xsl:apply-templates select="주소록/회원"/>
<tr>
<td align="center" colspan="2">인원수</td>
<td align="center" colspan="2"><xsl:value-of select="$bCount"/>명</td>
<td align="center" colspan="2">월저축액 합계 :<xsl:value-of select="format-number($bTotal,'###,###')"/> 원<br/> </td>
<td align="center" colspan="1">월저축액 평균 :<xsl:value-of select="format-number($bAverage,'###,###')"/> 원<br/> </td>
</tr>
</table>
</center>
</body>
</html>
</xsl:template>
<xsl:template match="회원">
<tr>
<td align="center"><xsl:number/></td>
<td><xsl:value-of select="이름"/></td>
<td><xsl:value-of select="생일/년"/>.
<xsl:value-of select="생일/월"/>.
<xsl:value-of select="생일/일"/>.</td>
<td><xsl:value-of select="연락처/전화"/></td>
<td><xsl:value-of select="연락처/주소1"/>
<xsl:value-of select="연락처/주소2"/></td>
<td align="right"><xsl:value-of select="format-number(월저축액,'###,###')"/></td>
<td align="center"><xsl:value-of select="2012-number(생일/년)"/>세</td>
</tr>
</xsl:template>
</xsl:stylesheet>