« XML Editing -- Rescued by TextPad | Main | Adding Line Numbers to a PDF generated from XML »

Using SAXON to apply XSL transform

Everytime I need this functionality, I endup spending atleast 10 minutes fumbling with the SAXON documentation to get the right command. I guess, I would do myself a service by having it as a weblog entry.

Assume that you have an XML file with appropriate xml-stylesheet PI and stylesheet to convert it into an XHTML document. The input document would look like:

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.2//EN" "xmlspec.dtd">
<?xml-stylesheet type='text/xsl' href='ws-spec.xsl' ?>
... Rest of the document ...

You can get the transofrmed document by issuing the command:

c:\>java -jar %SAXONDIR%\saxon.jar -a inpfile.xml > outfile.html

Here env. var. SAXONDIR points to the installation directory of SAXON (ex: c:\saxon-6.5.2)


This page contains a single entry from the blog posted on June 12, 2003 3:00 PM.

The previous post in this blog was XML Editing -- Rescued by TextPad.

The next post in this blog is Adding Line Numbers to a PDF generated from XML.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33