Crane Softwrights Ltd.

Resource Library - Debugging Stylesheets Using Microsoft IE5 XSL Processing

This has turned out to be a frequently asked question on the XSL maillist XSL-List info and archive: so now this resource can be refered to as a summary of a methodology to debug stylesheets being developed for the Microsoft IE5 XSL engine. This is useful because the menu function View/Source in IE5 shows the XML source, not the HTML resulting from the transformation described by the XSL stylesheet.

The page below is excerpted from XSLT training materials that can be obtained through the page:

  • Practical Transformation Using XSLT and XPath
    XSL Transformations and the XML Path Language
    (Fourth Edition - ISBN 1-894049-01-2 - 1999-08-02)

The XSL engine in Internet Explorer 5 can be invoked using a tool from Microsoft named the Windows Scripting Host. The script described below will load an XML document and an XSL stylesheet and emit the results of transforming the XML using the XSL.

By directing the emitted results to a file, the behaviour of the XSL engine on a given stylesheet is revealed, thus helping with the debugging of the stylesheet logic.

 Crane Logo


BOX 266,

+1 (613) 489-0999 (Voice)
+1 (613) 489-0995 (Fax)

Invoking the Microsoft XSL Processor (cont.)
Module 11: Sample Tool Information
Lesson 11-2: Microsoft Internet Explorer 5

Using the processor from the MSDOS command line:
//File:  msxsl.js - 1999-08-13 15:40
//Args:  input-file style-file output-file
var xml  = WScript.CreateObject("Microsoft.XMLDOM");          //input
var xsl  = WScript.CreateObject("Microsoft.XMLDOM");          //style
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 ));  
A sample invocation batch file (the cscript program is from the Windows Scripting Host utility):
@echo off
REM msxsl.bat
REM check arguments: %1=source XML, %2=script MSXSL, %3=result HTML
cscript //nologo ..\prog\msxsl.js %1 %2 %3
REM post-process results
A sample invocation:
X:\samp>..\prog\msxsl hello.xml hello.msxsl hello.mshtm
X:\samp>type hello.mshtm
<b><i><u>Hello world.</u></i></b>


PUBLIC +//ISBN 1-894049::CSL::Courses::PTUX//DOCUMENT Practical Transformation Using XSLT and XPath 1999-08-13 15:40//EN

Copyright Crane Softwrights Ltd. (203)

If anyone has comments on this document, they are welcome to send them to

1999-08-13 15:40