Here is a general purpose function that you can use to invoke an XSLT transform:
function runTransformation (transform) {
/* transform is a JavaScript object:
.xml = absolute path to the file to transform
.xsl = absolute path to the XSL stylesheet
.pro = XSLT processor (SAXON)
.out = absolute path to the transformed file.
.console = true to show the Console,
false to suppress the Console
.params = an array of objects containing
name/value pairs (optional)
*/
var cmd, count, i, result;
// Create the command string.
cmd = 'XSLTRunTrScenario ' +
'-file \"' + transform.xml + '\" ' +
'-xslfilepath \"' + transform.xsl + '\" ' +
'-processor \"' + transform.pro + '\" ' +
'-outputfilepath \"' + transform.out + '\"';
// See if Console messages should be displayed.
if (transform.console === false) {
cmd += " -dontusefmconsole";
}
// Add any parameters to the command line.
count = transform.params.length;
for (i = 0; i < count; i += 1) {
cmd += ' -sparam ' + transform.params[i].name + ' "' +
transform.params[i].value + '"';
}
// Invoke the transform.
result = CallClient ("FmXSLT", cmd);
}