Invoking XSLT from an application

Rather than running XSLT transformations from the command line, you may want to invoke transformations from your own application, perhaps one that runs within a web-based application server. If you use Saxon repeatedly to perform multiple transformations, this will always be much faster than running it each time from a command line, because of the overheads of starting up the Java Virtual Machine.

There are several APIs you can use to invoke Saxon's XSLT processor from an application.

The JAXP interface (Java)

On the Java platform, Saxon incorporates support for the standard JAXP transformation API (originally known as TrAX). This is compatible with the API for invoking other XSLT processors such as Xalan and Oracle.

This API is described in the documentation provided with JDK 1.5 and later. It is available online at http://download.oracle.com/javase/6/docs/api/. Look for the javax.xml.transform package.

The s9api interface (Java)

An alternative is to use Saxon's own s9api interface. This is designed to provide an integrated approach to XML processing across the different range of languages supported by Saxon; unlike JAXP, it includes support for XSLT 2.0 and 3.0 capabilities, and it also takes advantage of generics, thus giving a more strongly typed and therefore more robust interface.

The Saxon.Api interface (.NET)

There is also an API for Saxon on the .NET platform, designed to make Saxon available from .NET languages such as C#, VB.NET, and ASP.NET. See Saxon on .NET.

Links