Altova Mailing List Archives

Building Excel XML in ASP Script - MSXML6 Error - Orders.xsl (0/1)

From: Eric F <emf@------.--->
Date: 5/12/2007 8:14:00 PM

I am trying to develop an ASP application that will accept data from
SQL Server and build an Excel 2003 XML file which will be opened by
the client's Excel via MIME. There's an MS KB article art 285891 that
pretty much describes what I need to do, and I have followed it
exactly. I have deployed the ASP and XSL files on my local IIS 5.0
website. Whenever I go to localhost/ExcelXML.asp, I get this error

Error Type:
msxml6.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. 
/ExcelXML.asp, line 30

Browser Type:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322;
.NET CLR 2.0.50727) 

I have attached the XSL file. Here's the ASP code (lifted pretty much
straight from MS):

<%@ Language="vbscript"%>


    Const sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\program files\microsoft
    Const sXSL = "Orders.xsl"
    Response.Buffer = True

    'Retrieve an ADO recordset of the Orders Detail table in Northwind
    Dim rs, nRecords
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open "SELECT * FROM [Order Details]", sConn, 3, 3
    'Persist the recordset to a new DOMDocument and store the record
    Dim oXML
    Set oXML = CreateObject("MSXML2.DOMDocument.6.0")
    rs.Save oXML, 1
    nRecords = rs.RecordCount
    'Load the XSL (the workbook template with XSL directives) into a
    Dim oXSL
    Set oXSL = CreateObject("MSXML2.DOMDocument.6.0")
    oXSL.Load sXSL
    'Transform the XML using the stylesheet
    Dim oResults
    Set oResults = CreateObject("MSXML2.DOMDocument.6.0")
    oXML.transformNodeToObject oXSL, oResults '***THIS IS WHERE THE
ERROR OCCURS********************
    If oXSL.parseError.errorCode <> 0 Then
       Response.Write "Parse Error: " & oResults.parseError.reason

       'Modify the ss:ExpandedRowCount attribute for the <table> node
in the XSL.
        Dim oTable
        Set oTable =
        oTable.setAttribute "ss:ExpandedRowCount", nRecords + 2

        'Return the resulting XML Spreadsheet for display in Excel
        Response.ContentType = "application/"
        Response.Charset = "ISO-8859-1"
        Response.Write oResults.XML

    End If


Thanks in advance,



These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.