Programming XSLT

Each XSLT processor has its own proprietary API for invoking XSLT programs. The following examples show how the Microsoft and Apache processors are used.

XSLT and MSXML

MSXML 2.x (and above) provides the transformNode function for performing an XSLT transformation against an in-memory DOM. The following Javascript code illustrates how to use transformNode:

 // make sure parameters are correct if (WScript.Arguments.length != 2 && WScript.Arguments. length != 3) { WScript.echo("usage: xslt source stylesheet"); WScript.Quit(1); } var source = WScript.Arguments.Item(0); var stylesheet = WScript.Arguments.Item(1); // create DOM document for source & stylesheet docs var xmlSource = new ActiveXObject("MSXML2.DOMDocument"); var xmlStylesheet ...

Get Essential XML: Beyond Markup now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.