RE: [xsl] How to Save Transformed XML to Disk

Subject: RE: [xsl] How to Save Transformed XML to Disk
From: "XSLList" <xsllist@xxxxxxxxxxxxx>
Date: Mon, 3 Mar 2003 15:56:28 -0500
Imrran,

I just saw your message.  Here's a link
http://www.cranesoftwrights.com/resources/debugmsxml/ to an article that
describes how to do just this.

Here's the script and batch file (adapted from the article) to do transforms
from the command-line using Microsoft's processor.  Just save the two text
files in the same directory, and run the batch file (it'll prompt you for
usage.)  Very easy and a great help.  Note that if you're using a later
version of IE you might want to replace the "Microsoft.XMLDOM" with
"Msxml2.DOMDocument".  See
http://www.bayes.co.uk/xml/index.xml?/xml/utils/msxml_sniffer.htm to find
out which version(s) you have installed.

HTH,

--Jeff


=================== START msxml.js ==========================
//File:  msxml.js - 2000-04-20 16:30
//Info:  http://www.CraneSoftwrights.com/links/msxml.htm
//Args:  input-file style-file output-file
var xml  = WScript.CreateObject("Microsoft.XMLDOM");          //input
xml.validateOnParse=false;
xml.load(WScript.Arguments(0));
var xsl  = WScript.CreateObject("Microsoft.XMLDOM");          //style
xsl.validateOnParse=false;
xsl.load(WScript.Arguments(1));
var out = WScript.CreateObject("Scripting.FileSystemObject"); //output
var replace = true; var unicode = false; //output file properties
var hdl = out.CreateTextFile( WScript.Arguments(2), replace, unicode )
hdl.write( xml.transformNode( xsl.documentElement ));
//eof


===================== START msxml.bat =====================
@echo off
if (%3)==() goto usage
goto start
:usage
cls
echo.
echo.
echo ============================================
echo USAGE
echo     msxml XMLFileName XSLFileName OutputFileName
echo ============================================
echo.
echo.
goto end

rem ===============Processing====================
:start
cscript .\msxml.js %1 %2 %3
rem start iexplore %CD%\%3
start notepad.exe %3
goto end


rem ==================Exit=======================
:end

>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Imrran Wahid
>Sent: Thursday, February 20, 2003 1:21 PM
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: [xsl] How to Save Transformed XML to Disk
>
>
>Is there a way of saving the output XML (the result of
>transformation), to a file on disk for later reuse?
>
>Imrran
>


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


Current Thread