两个xml和两个xslt分别对应。
xmlA:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="10-1.xslt"?>
<class>
<name>XML成绩单</name>
<成绩>
<student>
<id>01</id>
<stuname>小张</stuname>
<age>20</age>
<sex>男</sex>
<core>80</core>
</student>
<student>
<id>02</id>
<stuname>小李</stuname>
<age>18</age>
<sex>女</sex>
<core>80</core>
</student>
<student>
<id>03</id>
<stuname>小王</stuname>
<age>21</age>
<sex>男</sex>
<core>80</core>
</student>
</成绩>
</class>
xsltA:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>XML成绩单</title>
</head>
<body>
<h2>XML成绩单</h2>
<table border="2" cellspacing="0">
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>成绩</th>
</tr>
<xsl:for-each select="class/成绩/student">
<tr>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="stuname"/></td>
<td><xsl:value-of select="age"/></td>
<td><xsl:value-of select="sex"/></td>
<td><xsl:value-of select="core"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
xmlB:
<?xml version="1.0" encoding="UTF-8"?>
<?xsl-stylesheet type="text/xsl" href="10-2.xslt"?>
<students>
<student id="20100101">
<name>王宏</name>
<java>96</java>
<oracle>88</oracle>
<uml>90</uml>
</student>
<student id="20100102">
<name>李娜</name>
<java>76</java>
<oracle>56</oracle>
<uml>70</uml>
</student>
<student id="20100103">
<name>孙武</name>
<java>77</java>
<oracle>70</oracle>
<uml>80</uml>
</student>
</students>
xsltB:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>成绩单</title>
</head>
<body>
<h2>学生成绩单</h2>
<table border="2" cellspacing="0">
<tr>
<th>学生姓名</th>
<th>java</th>
<th>oracle</th>
<th>uml</th>
</tr>
<xsl:for-each select="students/student">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="java"/>
</td>
<td>
<xsl:value-of select="oracle"/>
</td>
<td>
<xsl:value-of select="uml"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>