OICQshenshi 2003年06月08日
怎样显示单科成绩大于90分的学生名单?
单科成绩大于90分的学生名单.xml文件如下:

<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="单科成绩大于90分的学生名单.xsl"?>
<roster>
<student ID="001">
<stuid>001</stuid>
<name>John</name>
<Java>85</Java>
<Oracle>88</Oracle>
<Visualbasic>90</Visualbasic>
</student>

<student ID="002">
<stuid>002</stuid>
<name>Peter</name>
<Java>65</Java>
<Oracle>54</Oracle>
<Visualbasic>95</Visualbasic>
</student>

<student ID="003">
<stuid>003</stuid>
<name>Jacken</name>
<Java>95</Java>
<Oracle>82</Oracle>
<Visualbasic>67</Visualbasic>
</student>

<student ID="004">
<stuid>004</stuid>
<name>Windey</name>
<Java>76</Java>
<Oracle>87</Oracle>
<Visualbasic>75</Visualbasic>
</student>

<student ID="005">
<stuid>005</stuid>
<name>Anita</name>
<Java>88</Java>
<Oracle>65</Oracle>
<Visualbasic>99</Visualbasic>
</student>

<student ID="006">
<stuid>006</stuid>
<name>Richard</name>
<Java>87</Java>
<Oracle>78</Oracle>
<Visualbasic>90</Visualbasic>
</student>

<student ID="007">
<stuid>007</stuid>
<name>Regina</name>
<Java>90</Java>
<Oracle>76</Oracle>
<Visualbasic>59</Visualbasic>
</student>
<student ID="008">
<stuid>008</stuid>
<name>Kitty</name>
<Java>67</Java>
<Oracle>87</Oracle>
<Visualbasic>89</Visualbasic>
</student>
<student ID="009">
<stuid>009</stuid>
<name>Esmond</name>
<Java>65</Java>
<Oracle>87</Oracle>
<Visualbasic>89</Visualbasic>
</student>
<student ID="010">
<stuid>010</stuid>
<name>Dino</name>
<Java>98</Java>
<Oracle>98</Oracle>
<Visualbasic>88</Visualbasic>
</student>
<student ID="011">
<stuid>011</stuid>
<name>Hedy</name>
<Java>76</Java>
<Oracle>87</Oracle>
<Visualbasic>88</Visualbasic>
</student>
<student ID="012">
<stuid>012</stuid>
<name>Winster</name>
<Java>67</Java>
<Oracle>88</Oracle>
<Visualbasic>56</Visualbasic>
</student>
<student ID="013">
<stuid>013</stuid>
<name>David</name>
<Java>89</Java>
<Oracle>78</Oracle>
<Visualbasic>87</Visualbasic>
</student>
<student ID="014">
<stuid>014</stuid>
<name>Shaw</name>
<Java>97</Java>
<Oracle>95</Oracle>
<Visualbasic>99</Visualbasic>
</student>
<student ID="015">
<stuid>015</stuid>
<name>Nancy</name>
<Java>87</Java>
<Oracle>67</Oracle>
<Visualbasic>100</Visualbasic>
</student>
<student ID="016">
<stuid>016</stuid>
<name>Bell</name>
<Java>67</Java>
<Oracle>78</Oracle>
<Visualbasic>98</Visualbasic>
</student>
<student ID="017">
<stuid>017</stuid>
<name>Lynno</name>
<Java>88</Java>
<Oracle>58</Oracle>
<Visualbasic>87</Visualbasic>
</student>
<student ID="018">
<stuid>018</stuid>
<name>Mary</name>
<Java>93</Java>
<Oracle>67</Oracle>
<Visualbasic>78</Visualbasic>
</student>
<student ID="019">
<stuid>019</stuid>
<name>Smith</name>
<Java>57</Java>
<Oracle>90</Oracle>
<Visualbasic>65</Visualbasic>
</student>
<student ID="020">
<stuid>020</stuid>
<name>Betty</name>
<Java>55</Java>
<Oracle>65</Oracle>
<Visualbasic>58</Visualbasic>
</student>

</roster>



单科成绩大于90分的学生名单.xsl文件如下:

<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
<html>
<head>
<title>XSL文件在浏览器中显示Java考试成绩优秀(单科成绩大于90分)的学生名单</title>
</head>
<body>
<h2 align="center"><B>学生成绩单</B></h2>
<xsl:apply-templates select="roster"/>
</body>
</html>
</xsl:template>

<xsl:template match="roster">
<table border="1" cellpadding="0" align="center">
<tr align="center"><font face="黑体"><th>学号</th><th>姓名</th><th>Java</th><th>Oracle</th><th>Visual basic</th></font></tr>
<xsl:for-each select="student" order-by="+stuid">
<tr>
<xsl:if match="Java[.>'90']">
<td><xsl:value-of select="stuid"/></td>
<td><xsl:value-of select="name"/></td>
<td align="right"><xsl:value-of select="Java"/></td>
<td align="right"><xsl:value-of select="Oracle"/></td>
<td align="right"><xsl:value-of select="Visualbasic"/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
</xsl:template>

</xsl:stylesheet>
...全文
33 点赞 收藏 6
写回复
6 条回复

还没有回复,快来抢沙发~

发动态
发帖子
XML/XSL
创建于2007-09-28

7872

社区成员

2.2w+

社区内容

XML/XSL相关问题讨论专区
社区公告
暂无公告