Required white space was missing 是什么意思?
frogJ 2006-04-21 12:53:52 初学XML XSL
找了一个例子,MSDN上的,完全复制下来的~
http://www.microsoft.com/china/MSDN/library/enterprisedevelopment/softwaredev/SDaskgui05202003.mspx?mfr=true
下面是代码
1:books.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl" ?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
</book>
</catalog>
2:books.xsl
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Test</title>
</head>
<script language="JScript">
function Test_OnLoad()
{
var objXML = new ActiveXObject("MSXML2.DOMDocument");
objXML.async=false;
objXML.load("books.xml");
alert(objXML.xml);
objXML=null;
}
</script>
<body onload="Test_OnLoad()">
<table border="1">
<xsl:for-each select="catalog/book">
<tr>
<td>
<xsl:value-of select="author"/>
</td>
<td>
<xsl:value-of select="title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
3:books.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional 4.0//EN">
<%
dim sxh
Response.contentType = "text/xml"
set sxh = Server.CreateObject("MSXML2.XMLHTTP.3.0")
sxh.open "GET","http://localhost/AJAX/xmlbooks.xml",false
sxh.send
Response.write sxh.responsetext
%>
为什么一运行就出错:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Required white space was missing. Error processing resource 'http://localhost/AJAX/xml/books.asp'. Line 1, Position 55
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
这是怎么回事啊?高手给讲解一下原因和解决办法好么?