Installing the SXalan Package

For an overview of the installation steps, see Starting from Scratch.

At present, this package has only been tested on Linux. I think the configuration is correct for a Solaris machine, but my efforts to compile it there have illustrated that I do not have the the necessary header (Standard Template Library) files installed.

The package creates a version of Xalan, the XSL translator developed by the Apache Software Foundation. Ideally, one can download their binary distribution of Xalan and compile and link againts the files (i.e. headers and libraries) there. This will work if you have a compatible version of g++ (egcs 2.91.66) and glibc (glibc 2.1.2-11) that was used to create the libraries used there. If that is the case a standard installation should work.

Alternatively, when trying the standard installation, you may encounter errors about a missing symbol. In that case, you are probably using a different version of g++ that is incompatible with the Xalan binaries distributed by Apache.

There are two ways to fix this problem. You can

Differences from regular R Packages

This is a slightly unusual package since it is not intended to be used in a regular, interactive R session. Instead, the primary tool in the package is a stand-alone application that uses R. This makes installation quite different, but I have chosen (for better or worse) to try to simplify the interface for R users so that it install in the same way as a regular R package, i.e.
More typically you will have to provide information about where you located the Xalan binary distribution such as
R INSTALL -c  --configure-args='--with-xalan=/tmp/Clean' SXalan/
See Configuration Details.

This package provides its own Makefile in the src/ directory which is usually not encouraged. However, since we are not in fact building a shared library (.so or DLL), we have different needs and the R CMD INSTALL script is not well suited for this. (Note that it works very well in other cases that we are embedding R in other applications as a shared library.)

Configuration Details

The configuration script needs to find the XAlan and Xerces include files and libraries. For the commonly used Operating Systems, one can download a single binary distribution for Xalan which also contains Xerces. This is available from You can extract the files from this archive into any directory you wish and then tell the INSTALL command where to find it. There are two ways to specify this information.
  • Setting the environment variable XALANCROOT.
  • Using the --with-xalan flag for the configure script.
    Since you do not directly call configure, you have to pass these through the call to R CMD INSTALL. You do this with the --configure-args flag for INSTALL such as
     R CMD INSTALL -c --configure-args='--with-xalan=/tmp/Clean' SXalan/      
  • (Note that this value is different from the setting of XALANCROOT used when compiling Xalan.) You may also need to specify a value for XERCESCROOT which is where the C code for the Xerces XML parser can be found.

    Compiling Xalan

    The instructions for compiling Xalan from source are given on as a sequence of 9 steps. They work well on Linux. My Solaris machine did not have the STL.

    The compilation can take a long time to complete if your machine does not have a lot of memor and needs to swap.


    To test the installation, you can run the transformer on an example in the examples/ directory in the installed package. Change directory to wherever the library is installed (either in $R_HOME/library/SXalan/ or the SXalan directory within the directory specified via the -l flag for R CMD INSTALL). Within this examples/ directory, run the command
     ../bin/Sxslt -in report.xml -xsl report.xsl -out /tmp/report.html
    If this

    Installing Sxslt

    The result of compiling the package is a program Sxslt in the bin/ directory where the package was installed. You can move this file anywhere you like as its position is not important. However, it does refer to the file Sxslt.bin whose location is hard-coded. (Any suggestions for changing this?)

    Starting from Scratch

    This is what I had to do on a machine on which I previously did not have an account.
    Install R
    Download the source files and configure with --enable-R-shlib and then build.
    Download and un-tar Xalan-C_1_1 (-linux.tar.gz for me)
    Download the SXalan (SXalan_0.1-0.tar.gz) tar file
    R INSTALL -c --configure-args='--with-xalan=wherever'  SXalan_0.1-0.tar.gz

    Duncan Temple Lang <>
    Last modified: Fri Mar 30 12:47:38 EST 2001