Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xml transform to mulitple excel worksheets

From: "glen" <none@----.--->
To: NULL
Date: 9/4/2005 10:01:00 PM
I used the below asp code to transform xml to a spreadsheet using a .xsl 
file.
It works great; problem is I want to transform several recordset to xml to
multiple worksheets in the workbook.  Should I use something other than the
"transformNodeToObject"?  I can't see how to direct the xml to different
worksheets.  I appreciate any help.


<%@ Language="vbscript"%>
<%
    sConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("mydb.mdb")
    sXSL = Server.MapPath("mydb.xsl")
    Response.Buffer = True
    'Retrieve an ADO recordset of the Orders Detail table in mydb
    Dim rs, nRecords
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open "SELECT uDesc FROM mydbTable", sConn, 3, 3
    'Persist the recordset to a new DOMDocument and store the record count
    Dim oXML
    Set oXML = CreateObject("Microsoft.XMLDOM")
    rs.Save oXML, 1
    nRecords = rs.RecordCount
    rs.Close

    'Load the XSL (the workbook template with XSL directives) into a
DOMDocument
    Dim oXSL
    Set oXSL = CreateObject("Microsoft.XMLDOM")
    oXSL.Load sXSL

    'Transform the XML using the stylesheet
    Dim oResults
    Set oResults = CreateObject("Microsoft.XMLDOM")
    oXML.transformNodeToObject oXSL, oResults

    If oXSL.parseError.errorCode <> 0 Then
       Response.Write "Parse Error: " & oResults.parseError.reason
    Else

       'Modify the ss:ExpandedRowCount attribute for the <table> node in the
XSL.
        Dim oTable
        Set oTable = oResults.selectSingleNode("Workbook/Worksheet/Table")
        oTable.setAttribute "ss:ExpandedRowCount", nRecords + 2

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

 end if

%>





transparent
Print
Mail
Like It
Disclaimer
.

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 www.altova.com/list/index.html. 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.

.
.

transparent

transparent