[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Transform in-memory XML domDocument

Subject: Transform in-memory XML domDocument
From: "Damian Clark" <damianclark@xxxxxxxxxxxxxx>
Date: Sun, 10 Nov 2002 18:02:56 +1100
xmldoc.documentelement.attributes
Where am I going wrong?
Using an ASP page and MSXML, I want to build an XML file listing
document in memory, and then simply transform it -(using a stylesheet
that merges all the filenames provided).
The file listing will work when output directly to the browser with the
command 'xmlDoc.save response', but I can't seem to style it before
output.
Surely there is a simple answer to a basic problem but I can't find an
example anywhere.
My lack of VBscript skills will no doubt account for the error.
 
Error message:
'Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'xmlResponseDoc'
/CustomsXML/Serverside Revision II/test.asp, line 52'
 
The abbrev. ASP code FYI -
<%
Response.ContentType = "text/xml"

strRootPath = "xml/"

'Create xml document
Dim xmlDoc
Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.4.0")
 xmlDoc.async = false
Dim xmlPI, xmlElement, xmlAtt
'Set encoding of XML document
Set xmlPI = xmlDoc.appendChild(xmlDoc.createProcessingInstruction("xml",
"version='1.0' encoding='utf-8'"))
Set xmlDoc.documentElement = xmlDoc.createElement("xsl:output")
Set xmlAtt =
xmlDoc.documentElement.Attributes.setNamedItem(xmlDoc.createAttribute("m
ethod"))
xmlAtt.Value = ("'xml'")
'Create root element and set base attribute
Set xmlDoc.documentElement = xmlDoc.createElement("folder")
Set xmlAtt =
xmlDoc.documentElement.Attributes.setNamedItem(xmlDoc.createAttribute("l
ocation"))
xmlAtt.Value = strRootPath & strPath
'Reading subfolder and files
Dim objFileSystemObject, objDirectory, objSubDirectory, objFile
Set objFileSystemObject =
Server.CreateObject("Scripting.FileSystemObject")
Set objDirectory =
objFileSystemObject.GetFolder(Server.MapPath(strRootPath & strPath))
For Each objFile In objDirectory.Files
 'Create tree node
 Set xmlElement =
xmlDoc.documentElement.appendChild(xmlDoc.createElement("file"))
  'Make attribute "name" equal to file name
 Set xmlAtt =
xmlElement.Attributes.setNamedItem(xmlDoc.createAttribute("name"))
 xmlAtt.value = strRootPath & strPath & objFile.Name 
 Set xmlAtt =
xmlElement.Attributes.setNamedItem(xmlDoc.createAttribute("date"))
 xmlAtt.value = objFile.DatelastModified
Next

'---> no longer write directly to response stream 
'//xmlDoc.save response 
 
' --->create XSL object
Dim xslDoc
set xslDoc = Server.CreateObject("MSXML2.DomDocument.4.0")
 xslDoc.async = false
 xslDoc.load server.MapPath("customsnews_mergeDocs.xsl")

---> transform created Xml Document with Xsl doc.
xmlDoc.transformNodeToObject xslDoc, response --->'line 52, Error
message here.
 
%>
 
 
Damian Clark




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.