# Extensions

Extensions are supported in recent releases of Saxon and Xalan.

These extensions enable callouts, numbered program listings, and the direct inclusion of text:

    @rem = '--*-Perl-*--
    @echo off
    perl.exe %_batchname %$
    goto endofperl
    @rem ';

    # Compress mail...

    require 'n:/home/nwalsh/lib/cygnus.pl';
    require 'timelocal.pl';
    use Cwd;

    select (STDERR); $| = 1;
    select (STDOUT); $| = 1;

    @DIRS = ("/home/nwalsh/Mail");
    while (@DIRS) {
        $dir = shift @DIRS;
        opendir (DIR, $dir);
        while ($fname = readdir(DIR)) {
            $file = "$dir/$fname";
            next if ! -d $file;
            next if $fname =~ /^\.\.?$/;

            print "$file\n";
            push (@DIRS, $file);
            &compress ($file);
        }
    }

    exit;

The prologue handles embedding a Perl script in a DOS batch file.

The `goto` statement, interpreted by the DOS batch file interpreter, skips over the body of the Perl script.

The `require` statement sources in external program fragments.

The `use` statement is similar, but has additional utility. It is a Perl5 function. (Note that this callout area specifies both a line and a column.)

This is a user subroutine call.

## Saxon Extensions

The DocBook XSL Stylesheets include a set of Java extensions for Saxon.

### Installation

The extensions are included in the distribution in `extensions/saxon642.jar` and `extensions/saxon643.jar`. Use the former for Saxon version 6.4.2 and the latter for Saxon 6.4.3 or Saxon 6.4.4. Saxon version 6.4.1 and all prior releases contained a significant bug, they are not supported.

Just make sure that the right jar file is in your CLASSPATH when you run Saxon.

### Using the Extensions

For compatibility with other processors, the extensions are disabled by default. To enable the extensions, turn on `$saxon.extensions`, for example by passing `saxon.extensions=1` to Saxon.

For more control over the specific extensions, see .

## Xalan Extensions

The DocBook XSL Stylesheets include a set of Java extensions for XalanJ version 2. Extensions are not provided for XalanC at this time.

### Installation

The extensions are included in the distribution in `extensions/xalan2.jar`. Xalan 1 is not supported.

Just make sure that the jar file is in your CLASSPATH when you run Xalan.

### Using the Extensions

For compatibility with other processors, the extensions are disabled by default. To enable the extensions, turn on `$xalan.extensions`, for example by passing `-PARAM xalan.extensions 1` to Xalan.

For more control over the specific extensions, see .