How do I run XSLT transformations automatically from code?
You can run an XSLT transformation on an XML document programmatically using code written in Microsoft JScript®, Microsoft Visual Basic® Scripting Edition (VBScript), Microsoft Visual Basic, C++, or any other language that supports COM, including Perl. The following Visual Basic code calls a transformation against MSXML 4.0. This code sample uses the CreateObject(“Msxml2.DOMDocument”) syntax instead of the CreateObject(“Msxml.DOMDocument”) syntax associated with versions 2.x of MSXML. Using Msxml2 ensures that you call the most current XSLT processor, not the 1998 working draft version. This example also shows how to get detailed error information if your transformation fails. If you transform unstructured (non-XML) data, set xmlSource.ValidateOnParse=False instead of xmlSource.ValidateOnParse=True, as it appears in the following example. This step helps avoid an error caused when data is not well-formed.