error 80004005

liunx

Guest
I used the w3schools example for using xslt and asp to edit xml documents located at:
<!-- m --><a class="postlink" href="http://w3schools.com/xsl/xsl_editxml.asp">http://w3schools.com/xsl/xsl_editxml.asp</a><!-- m -->

The code I used is:

accounts.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href=http://www.htmlforums.com/archive/index.php/"accounts.xsl" type="text/xsl"?>
<accounts>
<account url="http://webepags.com/1">
<field id="username">admin</field>
<field id="password">jjdd4160</field>
</account>
</accounts>

accounts.xsl:

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<center>
<img src=http://www.htmlforums.com/archive/index.php/"webepags-logo.gif" alt="webepags logo" />
</center>
<h1 style="color:#0099FF; font-family:'Trebuchet MS'">Register to build a webepag</h1>
<xsl:for-each select="accounts/account/field">
<form id="register" method="post" action="accounts.asp">
<h3 style="color:#FF9900; font-family:'Trebuchet MS'">What username would you like to use? (this will be your URL as well)</h3>
<input type="text" style="height:42px; width:194px">
<xsl:attribute name="username">
<xsl:value-of select="@id" />
</xsl:attribute>
</input>
<h3 style="color:#FF9900; font-family:'Trebuchet Ms'">What password would you like to use?</h3>
<input type="text" style="height:42px; width:194px">
<xsl:attribute name="password">
<xsl:value-of select="@id" />
</xsl:attribute>
</input>
<p>
<input type="submit" id="btn_sub" name="btn_sub" value="Submit" />
<input type="reset" id="btn_res" name="btn_res" value="Reset" />
</p>
</form>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

accounts.asp:

<%
function loadFile(xmlfile,xslfile)
Dim xmlDoc,xslDoc

'Load XML file
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load(xmlfile)

'load XSL file
set xsldoc = Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async = false
xslDoc.load(xslfile)

'Transform file
Response.Write(xmlDoc.transformNode(xslDoc))
end function

function updateFile(xmlfile)
Dim xmlDoc, rootE1, f
Dim 1

'Load XML file
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load(xmlfile)

'Set the rootE1 variable equal to the root element
Set rootE1 = xmlDoc.documentElement

'Loop through the form collection
for i = 1 To Request.Form.Count
'Eliminate button elements in the form
if instr(1,Request.Form.Key(i), "btn_")=0 then

set f = rootE1.selectSingleNode ("account[@id='"&_ Request.Form.Key(i) & "']/field")
f.Text = Request.Form(i)
end if
next
xmlDoc.save xmlfile
%>

The problem is that I am getting this error message:

msxml3.dll- Error '80004005'

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

/scripts/accounts.asp, line 16

Can you please help me resolve this error message?Hi Hello World,

Couple of things - firstly, it's a lot easier to read the code that you post if you use the vb or code tags.

As for your problem, why have you got hyphens at the start of some of your lines?...


Paul.Hmmm... Have you got the XML and XSLT file in the same folder as the ASP code?The script works, because I tested it with the w3schools example. But with my xml and xslt, the script does not work. The script is in the same folder as the asp code.Simple, open the XML file accounts.xml in a browser and you will see it contains errors, which is why ASP is giving an error.

Remove the "-" lines in the XLS file and your problem is solved.LOL! That's pretty much what I was looking at!

HelloWorld - did it work?

BTW - DarkStreet, loved the 'Girls' flash in your sig - fantastic piece of work!


Paul.mandelbrot - indeed, I only saw afterwards we both had the same solution! Sorry if it seemed like I hijacked your solution.

Thanks for the compliment - it's a bit old though, wish I had more time to brush up on my Flash.Unfortunately, it didn't work

By the way, the girls flash is awesome
 
Back
Top