I pulled this utility script, xslt.js, from Microsoft's site and checked it in to the web directory. It allows you to do an XSL transform without the browser.
Usage: xslt inputFile xsltFile [options] -o outputFile -p paramName paramValue Example: c:\> cscript xslt.js faq.xml faq.xsl (We could probably modify the script to use the xsl referenced in the xml instead of having to pass in the xsl filename.) ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 15, 2002 11:22 AM Subject: [DQSD-CVS] dqsdweb xslt.js,NONE,1.1 > View the DQSD CVS repository here: > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/ > > Update of /cvsroot/dqsd/dqsdweb > In directory usw-pr-cvs1:/tmp/cvs-serv25501 > > Added Files: > xslt.js > Log Message: > utility for applying xsl transforms using MSXML > > --- NEW FILE: xslt.js --- > if (WScript.Arguments.length < 2) > { > WScript.echo("MSXML XSLT Utility\n"); > WScript.echo("usage: xslt inputFile xsltFile [options]"); > WScript.echo(" -o outputFile"); > WScript.echo(" -p paramName paramValue"); > WScript.Quit(1); > } > var source = WScript.Arguments.Item(0); > var stylesheet = WScript.Arguments.Item(1); > var xslTemplate = new ActiveXObject("MSXML2.XSLTemplate"); > var xmlSource = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); > var xmlStylesheet = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); > var xslProcessor = null; > var outputfile = ""; > > // load the source document > if (xmlSource.load(source)) > { > // load the stylesheet document > if (xmlStylesheet.load(stylesheet)) > { > try { > // associate the stylesheet with the template > xslTemplate.stylesheet = xmlStylesheet; > // create the XSLProcessor for this transformation > xslProcessor = xslTemplate.createProcessor(); > // specify the input and output streams > xslProcessor.input = xmlSource; > //xslProcessor.output = WScript.StdOut; > > if (WScript.Arguments.length > 2) > { > var i; > for (i=2; i<WScript.Arguments.length; i++) > { > option = WScript.Arguments.Item(i); > if (option == "-o") > { > outputfile = WScript.Arguments.Item(i+1); > } > else if (option == "-p") > { > var paramName = WScript.Arguments.Item(i+1); > var paramValue = WScript.Arguments.Item(i+2); > xslProcessor.addParameter(paramName, paramValue); > } > } > } > // call transform > b = xslProcessor.transform(); > > if (outputfile == "") > WScript.echo(xslProcessor.output); > else > { > var fso = new ActiveXObject("Scripting.FileSystemObject"); > var txtFile = fso.CreateTextFile(outputfile, true); > txtFile.WriteLine(xslProcessor.output); > txtFile.Close(); > } > } > catch(e) > { > WScript.echo("### tranform error: " + e.description); > } > } > else WScript.echo("### parse error: " + xmlStylesheet.parseError.reason); > } > else WScript.echo("### parse error: " + xmlSource.parseError.reason); > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > DQSD-CVS mailing list > https://lists.sourceforge.net/lists/listinfo/dqsd-cvs > DQSD CVS repository: > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/ > ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ DQSD-Devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dqsd-devel
