Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error : Document Element....

Status
Not open for further replies.

jedownsjr

IS-IT--Management
Jun 2, 2003
121
US
I have a very simple XML file which is formatted using an XSL file. I basically output the data using ASP where I create a new object for each (the XML file and also the XSL file), then use the load method on each file. I am receiving an error message:
"msxml4.dll '0x80004005'
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document."

I am using MSXML4.0. I can't get rid of this error -- any ideas?
Here's what I think it is referring to as my document element, which it doesn't like:
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;
 
If it's not well-formed, you could be missing the closing tag:

</xsl:stylesheet>

 
Thank you for your response. I have that tag, but maybe I am missing something else. (I'm still not very experienced with XML, but I have used it successfully in the past with MSXML3.0.) Do you notice anything else that looks wrong?

--------------------------------------------
Here is my XSL:
--------------------------------------------

<?xml version='1.0'?>
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot; <xsl:template match=&quot;/&quot;>
<HTML>
<BODY>
<title>Daily Report</title>
<table border=&quot;1&quot;>
<xsl:for-each select=&quot;daily/ticket&quot;>
<tr>
<td>Client Code: <I><xsl:value-of select=&quot;client&quot; /></I><BR/></td>
</tr>
</xsl:for-each>
</table>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>


----------------------------------------------------
HERE IS MY XML:
----------------------------------------------------
<?xml version=&quot;1.0&quot; ?>
<daily>
<ticket>
<client>
AAA
</client>
</ticket>
<ticket>
<client>
BBB
</client>
</ticket>
</daily>

----------------------------------------------------
HERE IS MY ASP CODE:
----------------------------------------------------

<%

Set xmlDoc = Server.CreateObject(&quot;MSXML2.DOMDocument.4.0&quot;)



' Halt execution until the document has been loaded

xmlDoc.async = false


xmlDoc.load(&quot;detail.xml&quot;)



Set xslDoc = Server.CreateObject(&quot;MSXML2.DOMDocument.4.0&quot;)

xslDoc.async = false


xslDoc.load(&quot;v3.xsl&quot;)


Response.write(xmlDoc.transformNode(xslDoc))

%>
 
NOTE: The semicolon at the end of the 2nd line isn't really in my file -- this post just added it for some reason. :)
 
Your XSL and XML look fine. Running them through xt produces this:

Code:
<HTML>
<BODY>
<title>Daily Report</title>
<table border=&quot;1&quot;>
<tr>
<td>Client Code: <I>
AAA
</I>
<BR>
</td>
</tr>
<tr>
<td>Client Code: <I>
BBB
</I>
<BR>
</td>
</tr>
</table>
</BODY>
</HTML>

So I'd say the problem with HEY! MSXML2? TWO? You have to step up to MSXML3 or MSXML4. Otherwise, change your XSL declaration to the pre-standard URI.

HTH,
harebrain
 
I've tried:
MSXML2.DOMDocument.4.0
MSXML3.DOMDocument.4.0
MSXML4.DOMDocument.4.0
Microsoft.XMLDOM
...just about everything I know to put on those lines. I still either get a message that the ActiveX object cannot be created (probably cause the syntax is wrong) or I get the message that the stylesheet doesn't have a document element (when using Microsoft.XMLDOM - it says &quot;msxml3.dll&quot; instead of &quot;msxml4.dll&quot;.

I guess there is some difference in calling these between versions of MSXML, but I can't figure out what I need to enter to make it work. Any more ideas? Do you know what version of MSXML you were using that produced the output?

Thanks!
 
I didn't use MSXML at all. I ran your data through xt, a free XSLT engine. You can get it at
It's a command line utility that, when given an XML file and an XSL stylesheet spits out the resulting XML. Highly recommended for test cases such as this.

Your ASP &quot;looks&quot; OK to me, but, since I don't use MSXML, I don't know what to tell you. I would get rid of the older, redundant versions of MSXML, particularly 2 (which doesn't conform to the final W3C recommendation and will produce different results.)

Finally, here's a wild guess that's worth a shot: delete the <?xml...?> declaration from your stylesheet. I most often see (and use) XSL without this declaration.

Good luck,
harebrain
 
I was having a similiar problem. Besides having the new MSXML on your computer the server running the asp must also be upgraded. It was working on my computer using Personal Web Server but would not work on the actual web served until I realized that they weren't running the latest MSXML.

Hope that helps.

Tom Burrows
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top