Chapter 2. Saxon Extensions
Prev |  | Next

## Chapter 2. Saxon Extensions

Beginning with release 1.25, the DocBook XSL Stylesheets include a set of Java extensions for Saxon.

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

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

        # Compress mail...

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

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

     25         print "$file\n";
                push (@DIRS, $file);
                &compress ($file);
            }
        }
     30
        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.

## Installation

The extensions are included in the distribution in `extensions/nwalsh.jar`. Just make sure that jar file is in your CLASSPATH when you run Saxon.

Prev | Home | Next
Customizing DocBook XSL stylesheets | Up | Using the Extensions