Using IE5/B2 XSL from Command Line

Subject: Using IE5/B2 XSL from Command Line
From: "Steve Muench" <SMUENCH@xxxxxxxxxxxxx>
Date: 10 Dec 98 12:11:29 -0800
In my experimentation with IE5 Beta2, I've found it useful to be
able to use the XSL transformation features from the command line
to "try things out" without writing code to do the transformation.

If you install the "Windows Scripting Host" (a little engine that
lets you run JS or VB scripts as if they were .BAT/.CMD files)
you can very easily build yourself a little utility to make this easy.

In case this might be useful to you, here's what I did:

(1) Downloaded and installed Windows Scripting Host
    http://msdn.microsoft.com/scripting/windowshost/default.htm

(2) Wrote the following little script in JavaScript:

    // This file is:  xslproc.js
    var data = WScript.CreateObject("Microsoft.XMLDOM");
    var style = WScript.CreateObject("Microsoft.XMLDOM");
    data.load(WScript.Arguments(0));
    style.load(WScript.Arguments(1));
    WScript.Echo( data.transformNode( style.documentElement ));

(3) Wrote the following little BAT file to make running the above script
    easier:

    @REM This file is:  xsl.bat
    @echo off
    @cscript //nologo xslproc.js %1 %2    REM xsl.bat

Then I can "try out" combining an XML document and a stylesheet at
the command line with:

   C:\>  xsl mydoc.xml mystyle.xsl

This dumps the transformed output to standard out so you could redirect it
like:

   C:\>  xsl mydoc.xml mystyle.xsl > mynewtree.xml


Quick and dirty, but works well for me.

Have fun...

____________________________________________________________________________
 Steve  | Consulting PM & XML Technology Evangelist | smuench@xxxxxxxxxx
 Muench |      Java Business Objects Dev Team       | geocities.com/~smuench

         Get to know JBO at http://javatools/jbo/owa/walkthrough
                Do you XML? http://xml.us.oracle.com


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


Current Thread