SCRIPT16389: The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document

StackOverflow https://stackoverflow.com/questions/23629754

  •  21-07-2023
  •  | 
  •  

Question

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>

and it's saying the error is on line 23 "document.write(xml.transformNode(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>

I'm not sure why it is producing this error and why it won't load.

Was it helpful?

Solution

After the line xsl.load("rdRoster.xsl"), output xsl.parseError.reason, then you will see an error message telling you why the parsing failed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top