SCRIPT16389:样式表不包含文档元素。样式表可能为空,也可能不是格式良好的XML文档 [英] SCRIPT16389: The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document
问题描述
我试图在IE浏览器中加载它,但它说有错误,并且不会加载。我使用Jscript代码来加载我的XSL和XML文档。
I'm attempting to load this in internet explorer however it's saying there is an error and it wont load. I'm using a Jscript code to load my XSL and XML documents.
我用这个脚本加载我的文档:
I'm loading my documents with this script:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>UFC Roster</title>
<script type="text/javascript">
// Load XML
var xml = new ActiveXObject("MSXML2.DOMDocument")
xml.async = false
xml.load("UFCRoster.xml")
// Load the XSL
var xsl = new ActiveXObject("MSXML2.DOMDocument")
xsl.async = false
xsl.load("rdRoster.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
</head>
<body>
</body>
</html>
并且它说错误在第23行document.write(xml.transformNode(xsl))
and it's saying the error is on line 23 "document.write(xml.transformNode(xsl))"
但我不太确定这个错误发生的原因。这是与它一起使用的XSL文档。它尚未完成,但它没有加载,所以我不能做任何改变呢。
But I'm not quite sure why this error is happening. Here's the XSL document that goes with it. It isnt finished yet but it isnt loading at all so i cant make any changes to it yet.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">
<html>
<head>
<title>UFC Roster</title>
<link href="style1.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
</style>
</head>
<body leftmargin="0" topmargin="0" border="0">
<a name="top"></a>
<table width="100%" cellpadding="0" cellspacing="0" ID="Table1" border="0">
<tr>
<td valign="bottom">
<table cellpadding="0" cellspacing="0" ID="Table2">
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" ID="Table3" border="0">
<tr height="280px">
<!-- <td valign="bottom"><img src="" id="" border="0" /></td> -->
</tr>
<tr>
<td class="red" valign="top" width="870px" height="310px">
<table width="100%" cellpadding="6" cellspacing="0" ID="Table4">
<tr>
<td align="center" width="920px" valign="top">
<table cellpadding="0" cellspacing="0" ID="Table7">
<tr>
<td height="75px"></td>
</tr>
<tr>
<td valign="top">
<table cellpadding="0" cellspacing="0" align="right">
<tr><td>
<td valign="top">
<table cellpadding="0" cellspacing="0" align="right">
<tr><td>
<xsl:for-each select="UFCFighters/Division" >
<xsl:if test="@class='Heavyweight'">
<table cellpadding="0" cellspacing="10">
<tr>
<td><a name="{/name}"></a>
<img class="picborder2" src="images/{details/name}.jpg" alt="{details/name}" width="100px" height="150px" />
</td>
<td width="450px">
<table>
<tr>
<td>
<table>
<tr>
<!--Comment--> <td class="name"><xsl:value-of select="details/name" /></td>
<td class="rightborder"></td>
<td valign="bottom">
<table cellpadding="0" cellspacing="5">
<tr>
<td class="label"><b>Rank</b></td>
<td class="value"><xsl:value-of select="details/rank" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td class="label" height="20px">From</td>
<td class="value"><xsl:value-of select="From" /></td>
<td class="rightmargin"></td>
<td class="label">Fights Out of</td>
<td class="value"><xsl:value-of select="Fights_out_of" /></td>
<!-- <td><a href="villains.html#{enemy}"><img src="images/arrow_red.bmp" border="0" /></a></td> -->
</tr>
</table>
</td>
</tr>
<tr>
<td class="bio"><xsl:value-of select="bio" /></td>
<td class="age"><xsl:value-of select="age" /></td>
<td class="height"><xsl:value-of select="height" /></td>
<td class="weight"><xsl:value-of select="weight" /></td>
<td class="college"><xsl:value-of select="college" /></td>
<td class="degree"><xsl:value-of select="degree" /></td>
<td class="record"><xsl:value-of select="record" /></td>
<td class="summary"><xsl:value-of select="summary" /></td>
<td class="submissions"><xsl:value-of select="submissions" /></td>
<td class="striking"><xsl:value-of select="striking" /></td>
<td class="takedowns"><xsl:value-of select="takedowns" /></td>
</tr>
</table>
</td>
</tr>
<tr> <!--Check This Section -->
<td class="border" colspan="2"><br/>
</td>
</tr>
</table>
</xsl:if>
</xsl:for-each>
</td></tr>
</table>
</td>
</tr>
</table>
</td> <!-- To here -->
<td class="smalltext" width="300px" valign="top">
<table cellpadding="0" cellspacing="0" ID="Table5">
<tr>
<td align="right" valign="top" height="75px"><img src="" /></td>
</tr>
<tr>
<td class="border" height="15px"><br /></td>
</tr>
<tr>
<td height="20px">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="rightmarginsmall"><a class="value" href="index.html">Back</a></td>
<!-- <td><a href="index.html"><img src="images/arrow_red_back.bmp" border="0" /></a></td> -->
</tr>
</table>
</td>
</tr>
<tr>
<td class="border" height="15px"><br /></td>
</tr>
<tr>
<td height="20px">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="rightmarginsmall"><a class="value" href="rdRoster.xsl">XSLT</a></td>
<!-- <td><a href="trvillains.xsl"><img src="images/arrow_red.bmp" border="0" /></a></td> -->
</tr>
</table>
</td>
</tr>
<tr>
<td class="border" height="916px"><br /></td>
</tr>
<tr>
<td height="20px">
<table cellpadding="0" cellspacing="0">
<tr>
<!-- <td class="rightmarginsmall"><a class="value" href="#top">Top</a></td> -->
<!-- <td><a href="#top"><img src="" border="0" /></a></td> -->
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding="2" cellspacing="0">
<tr>
<td class="blacktext">Created 2014</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我不知道它为什么会产生这个错误,为什么它不会加载。 p>
I'm not sure why it is producing this error and why it won't load.
推荐答案
输出 xsl.parseError.reason
,那么您将看到一条错误消息,告诉您解析失败的原因。
After the line xsl.load("rdRoster.xsl")
, output xsl.parseError.reason
, then you will see an error message telling you why the parsing failed.
这篇关于SCRIPT16389:样式表不包含文档元素。样式表可能为空,也可能不是格式良好的XML文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!