var oArgs = WScript.Arguments;

if (oArgs.length == 0)
{
   WScript.Echo ("Usage : cscript xslt.js xml xsl");
   WScript.Quit();
}
xmlFile = oArgs(0) + ".xml";
xslFile = oArgs(1) + ".xsl";

var xsl = new ActiveXObject("MSXML2.DOMDocument");
var xml = new ActiveXObject("MSXML2.DOMDocument");
xml.validateOnParse = false;
xml.async = false;
xml.load(xmlFile);

if (xml.parseError.errorCode != 0)
   WScript.Echo ("XML Parse Error : " + xml.parseError.reason);

xsl.async = false;
xsl.load(xslFile);

if (xsl.parseError.errorCode != 0)
   WScript.Echo ("XSL Parse Error : " + xsl.parseError.reason);

//WScript.Echo (xml.transformNode(xsl.documentElement));

try
{
   WScript.Echo("<HTML><HEAD><style>H1 {background-color:black; color:gold;font-family:verdana;}" +
		"H2 {background-color:yellow; font-family:verdana;}.desc {color:blue; font-family:verdana;font-size:12}" +
		".item {font-family:verdana;font-size:14}.secttitle {background-color:orange; font-weight:bold;font-family:verdana;font-size:18}" +
		"</style><TITLE>Sonique 2 Help</TITLE>");

   WScript.Echo (xml.transformNode(xsl.documentElement) + "</BODY></HTML>");


}
catch(err)
{
   WScript.Echo ("Transformation Error : " + err.number + "*" + err.description);
}

