M
Matt
This xslttest.asp will call xmldata.xml and table.xsl to output table.html.
However, it has the following run-time error on code:
xml.transformNodeToObject xsl, ofile 'produces UTF-8:
Error Type:
msxml3.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.
Any ideas? Thanks!!
//----------------------------
xslttest.asp -----------------------------------------------
<%
Set xml = CreateObject("Msxml2.DOMDocument")
Set xsl = CreateObject("Msxml2.DOMDocument")
xml.async = False
xsl.async = false
xml.Load "xmldata.xml"
xsl.Load "table.xsl"
set ofile = CreateObject("ADODB.Stream")
ofile.Type = 2
ofile.Charset = "Windows-1252"
ofile.LineSeparator = -1
ofile.open
xml.transformNodeToObject xsl, ofile 'produces UTF-8
ofile.SaveToFile "table.html", 2
%>
//------------------------------
xmldata.xml ----------------------------------------------
<?xml version="1.0"?>
<level1>
<level2>
<level3>
<name>name1</name>
<value>value1</value>
</level3>
<level3>
<name>name2</name>
<value>value2</value>
</level3>
</level2>
<level2>
<level3>
<name>name3</name>
<value>value3</value>
</level3>
</level2>
</level1>
//-----------------------------------
table.xsl --------------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt">
<xsl
utput method="html" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="//level3">
<tr>
<td><xsl:value-of select="name" /></td>
<td><xsl:value-of select="value" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
However, it has the following run-time error on code:
xml.transformNodeToObject xsl, ofile 'produces UTF-8:
Error Type:
msxml3.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.
Any ideas? Thanks!!
//----------------------------
xslttest.asp -----------------------------------------------
<%
Set xml = CreateObject("Msxml2.DOMDocument")
Set xsl = CreateObject("Msxml2.DOMDocument")
xml.async = False
xsl.async = false
xml.Load "xmldata.xml"
xsl.Load "table.xsl"
set ofile = CreateObject("ADODB.Stream")
ofile.Type = 2
ofile.Charset = "Windows-1252"
ofile.LineSeparator = -1
ofile.open
xml.transformNodeToObject xsl, ofile 'produces UTF-8
ofile.SaveToFile "table.html", 2
%>
//------------------------------
xmldata.xml ----------------------------------------------
<?xml version="1.0"?>
<level1>
<level2>
<level3>
<name>name1</name>
<value>value1</value>
</level3>
<level3>
<name>name2</name>
<value>value2</value>
</level3>
</level2>
<level2>
<level3>
<name>name3</name>
<value>value3</value>
</level3>
</level2>
</level1>
//-----------------------------------
table.xsl --------------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt">
<xsl
<xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="//level3">
<tr>
<td><xsl:value-of select="name" /></td>
<td><xsl:value-of select="value" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>