Re: [xsl] writing to file from MSXML 4.0

Subject: Re: [xsl] writing to file from MSXML 4.0
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Fri, 6 Jun 2008 13:52:14 +0100
--------------------------------------------------
From: "Christian Wittern" <cwittern@xxxxxxxxx>
Sent: Friday, June 06, 2008 1:38 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] writing to file from MSXML 4.0

Dear List members,

The problem I have involves using a MSXML 4.0 processor, which is embedded
in an application to write some of the processed information to a file. I
can't change the application, all I can do is write an XSL stylesheet to
achieve this.

In one or the other form this seems to be a problem that shows up here and
elsewhere and the answer seems to be "can't be done in MSXML, but why don't
you use a JScript one-liner to create a node-set and write it out to a
file?". I asked Mr Google and his friends all things that I could imagine
to turn up something that actually gives this mysterious one-liner, but to
no avail. So here I am asking those in the know for a complete example of
how to write a node-set generated with the XSLT processor of MSXML 4.0 to a
file with JSscript. I have never programmed in JScript and not touched any
programming on Windows for many years, so I have absolutely no idea what
needs to be done here.


Any help appreciated,

Christian

--

Christian Wittern
Institute for Research in Humanities, Kyoto University
47 Higashiogura-cho, Kitashirakawa, Sakyo-ku, Kyoto 606-8265, JAPAN

Chris

Basically you use transformNodeToObject, there's an example here: http://msdn.microsoft.com/en-us/library/ms766561(VS.85).aspx
If your output is XML then use the same logic as the example except instead of the last line (WScript.echo) use result.save(<path to save to>).
If the output is not XML you can use an ADODB.Stream instead of a DomDocument to accept the result and write to disk.



Joe
http://joe.fawcett.name


Current Thread