며칠전부터 이걸로 끙끙알아서 죶같다지나ㅉ
씨1발 정렬이랑 색벗어나는거 좀 귀뜸좀 ㅠㅠ맨
<?xml version="1.0" encoding="EUC-KR"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" indent="yes"/>
<xsl:template match="result">
<html>
<head>
<title>성적표</title>
<style type="text/css">
td { font-size: 9pt; line-height: 18pt; text-align: center }
td.title { color: #550000; ----color: #F8F3F4; font-weight: bolder }
</style>
</head>
<body>
<table width="600" border="1" cellpadding="0" cellspacing="0" bordercolor="black">
<tr>
<td class="title">이수<br/>구분</td>
<td class="title">교과목명</td>
<td class="title">학점</td>
<td class="title">출석<br/>점수</td>
<td class="title">과제<br/>점수</td>
<td class="title">중간<br/>고사</td>
<td class="title">기말<br/>고사</td>
<td class="title">총점</td>
<td class="title">평균</td>
<td class="title">성적</td>
</tr>
<xsl:for-each select="subject">
<xsl:sort data-type="number" order="descending" select="총점"/>
<tr>
<td>
<xsl:apply-templates select="sub_info/@section" />
</td>
<td>
<xsl:value-of select="subject_name" />
</td>
<td>
<xsl:value-of select="sub_info/@point" />
</td>
<xsl:apply-templates select="mark" />
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="sub_info/@section">
<xsl:choose>
<xsl:when test=".=1">
<xsl:text>전공</xsl:text>
</xsl:when>
<xsl:when test=".=2">
<xsl:text>교양</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>선택</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="mark">
<td>
<xsl:value-of select="@attendance" />
</td>
<td>
<xsl:if test="true()!=current()[@homework]">
<xsl:text>-</xsl:text>
</xsl:if>
<xsl:value-of select="@homework" />
</td>
<td>
<xsl:if test="true()!=current()[@middle_exam]">
<xsl:text>-</xsl:text>
</xsl:if>
<xsl:value-of select="@middle_exam" />
</td>
<td>
<xsl:if test="true()!=current()[@end_exam]">
<xsl:text>-</xsl:text>
</xsl:if>
<xsl:value-of select="@end_exam" />
</td>
<td>
<xsl:variable name="sum">
<xsl:value-of select="sum(@attendance)+sum(@homework)+sum(@middle_exam)+sum(@end_exam)" />
</xsl:variable>
<xsl:value-of select="$sum" />
</td>
<td>
<xsl:variable name="ava">
<xsl:value-of select="format-number($sum div 4, '##0.0')" />
</xsl:variable>
<xsl:value-of select="$ava" />
</td>
<td>
<xsl:call-template name="average">
<xsl:with-param name="ava_param" select="$ava" />
</xsl:call-template>
</td>
</xsl:template>
<xsl:template name="average">
<xsl:param name="ava_param" />
<xsl:choose>
<xsl:when test="$ava_param > 95">
<tr bgcolor="yellow"><xsl:text>A+</xsl:text></tr>
</xsl:when>
<xsl:when test="$ava_param > 90">
<xsl:text>A0</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 85">
<xsl:text>B+</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 80">
<xsl:text>B0</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 75">
<xsl:text>C+</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 70">
<xsl:text>C0</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 65">
<xsl:text>D+</xsl:text>
</xsl:when>
<xsl:when test="$ava_param > 60">
<xsl:text>D0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>F</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
댓글 0