I wrote a vbscript that uses xml/xslt transformation and it working except
for one thing I would like to change. The script goes through many xml files
and transforms the data to file named Data.xml. The item I would like to
figure out how to do is everytime a xml file is passed to the function it
always overwites the previous data. For example, if I passed 100 xml files
the data in the data.xml file would be only data from the 100th file. I am
unable to figure out how to append the data into one big file.
Code from function below..................
set fso = CreateObject("Scripting.FileSystemObject")
set wshell = CreateObject("Wscript.Shell")
set storefolder = fso.GetFolder(path)
set subfolders = storefolder.subfolders
set xDom = CreateObject("MSXML2.DOMDocument")
xDom.async = false
set xslt= CreateObject("MSXML2.DOMDocument")
xslt.async = false
set newDom = CreateObject("MSXML2.DOMDocument")
newDom.async = false
for each subf in subfolders
wscript.echo subf.name
bDone = false
for each f in subf.Files
if UCase(right(f.name,7)) = "WMI.XML" then
xDom.Load f.Path
'----------------------------------name of the file we need to get data
from.
xslt.Load
"c:\Projects\PSMT\wmiload.xslt" '---------------------template for what
data to get from the xml file.
transformedStr =
xDom.transformNode(xslt)
newDom.loadXML transformedStr
newDom.save "c:\temp\data.xml"
'--------------save transformed data to data.xml.
End If
next
next