XML/XSLT Transform Error in ASP
I'm in the process of migrating my site from classic ASP to ASP.NET 2.0, but I need to use some of the classic ASP apps until this process is complete. I'm trying to use a XML/XSLT transformation within an ASP doc (w/JScript syntax), but I'm getting an error. This setup works fine in my ASP.NET page, and I know that the XSLT doc is proper, so I'm thoroughly confused. I've included code for all of the referenced pages below, and all of these files are located in the same directory on my machine. If anyone can let me know what I'm doing wrong, that would be great. Thanks.
xmldoc.xml:
<?xml version="1.0" encoding="UTF-8"?>
<xmldoc>
<section>
<title>Page 1</title>
<url>page1.asp</url>
</section>
<section>
<title>Page 2</title>
<url>page2.asp</url>
</section>
</xmldoc>
xsldoc.xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
[list]
<xsl:for-each select="xmldoc/section">
<li><a href="{url}"><xsl:value-of select="title" /></a></li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
aspdoc.asp (JScript syntax):
<%
//Load XML
var xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load("xmldoc.xml")
//Load XSL
var xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("xsldoc.xsl")
//Transform file
Response.Write(xml.transformNode(xsl))
%>
HTML output wanted:[list]
<li><a href="page1.asp">Page 1</a></li>
<li><a href="page2.asp">Page 2</a></li>
</ul>
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.
KWilliams
|