1.xml文件内容如下:
1<books>
2<图书
3isbn="7-111-047064">
4<书名>Java编程思想<!--书名-->
5<作者>Bruce Eckel<!--作者-->
6<出版时间>
7<年份>1999<!--年份-->
8<月份>4<!--月份-->
9<!--出版时间-->
10<价格>60元<!--价格-->
11<!--图书-->
12<图书
13isbn="7-222-047064">
14<书名>VB.NET高级指南<!--书名-->
15<作者>Bruce Eckel<!--作者-->
16<出版时间>
17<年份>2002<!--年份-->
18<月份>4<!--月份-->
19<!--出版时间-->
20<价格>86元<!--价格-->
21<!--图书-->
22</books>
--------------------------
book.dtd如下:
----------------------------
xml.xsl内容如下:
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2<xsl:output encoding="GB2312"></xsl:output>
3<xsl:template match="books">
4<html>
5<head>
6<title>最畅销图书列表</title>
7</head>
8<body>
9<xsl:apply-templates select="图书">
10</xsl:apply-templates></body></html>
11</xsl:template>
12<xsl: match="图书" template="">
13<hr/>
14<p>
15<xsl:value-of select="书名">
16<xsl:value-of select="作者">
17<xsl:value-of select="出版时间">
18<xsl:value-of select="价格">
19</xsl:value-of></xsl:value-of></xsl:value-of></xsl:value-of></p>
20
21</xsl:></xsl:stylesheet>
现在不知为什么用浏览器浏览时出错!
错误提示如下:
结束标记 'BODY' 与开始标记 'xsl:apply-templates' 不匹配。处理资源 'http://dellserver/xml/xml.xsl' 时出错。第 13 行,位置: 6
-----^
请教各位大虾!
---------------------------------------------------------------
xml.xsl文件中 第五行
1<xsl:template match="books">改为:
2<xsl:template match="/">
312行<xsl:apply-templates select="图书"></xsl:apply-templates>改为:
4<xsl:apply-templates select="*/图书"></xsl:apply-templates>
5
6book.dtd文件中加一行:<!--ELEMENT books (图书)+-->
7
8还有一些书写问题:如:<XSL 改为小写</xsl:template></xsl:template>