1<html><head> 2 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 3 <title>Chapter 2. Saxon Extensions</title><link rel="stylesheet" href="reference.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.37"><link rel="home" href="index.html" title="DocBook XSL Stylesheet Documentation"><link rel="up" href="index.html" title="DocBook XSL Stylesheet Documentation"><link rel="previous" href="ch01s04.html" title="Customizing DocBook XSL stylesheets"><link rel="next" href="ch02s02.html" title="Using the Extensions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Saxon Extensions</th></tr><tr><td width="20%" align="left"><a href="ch01s04.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a href="ch02s02.html">Next</a></td></tr></table><hr></div><p>Beginning with release 1.25, the DocBook XSL Stylesheets include 4a set of Java extensions for Saxon.</p><p>These extensions enable callouts, numbered program listings, and 5the direct inclusion of text:</p><div class="programlistingco"><pre class="programlisting">@rem = '--*-Perl-*-- 6@echo off 7perl.exe %_batchname %$ 8goto endofperl 9@rem '; 10 11# Compress mail... 12 13require 'n:/home/nwalsh/lib/cygnus.pl'; 14require 'timelocal.pl'; 15use Cwd; 16 17select (STDERR); $| = 1; 18select (STDOUT); $| = 1; 19 20@DIRS = ("/home/nwalsh/Mail"); 21while (@DIRS) { 22 $dir = shift @DIRS; 23 opendir (DIR, $dir); 24 while ($fname = readdir(DIR)) { 25 $file = "$dir/$fname"; 26 next if ! -d $file; 27 next if $fname =~ /^\.\.?$/; 28 29 print "$file\n"; 30 push (@DIRS, $file); 31 &compress ($file); 32 } 33} 34 35exit;</pre><div class="calloutlist"><a name="c44b1b4b5b3"></a><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><a name="c44b1b4b5b3b1"></a><img src="/images/callouts/1.png" alt="1" border="0"></td><td valign="top" align="left"><p>The prologue handles embedding a Perl script in a DOS batch file.</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="c44b1b4b5b3b2"></a><img src="/images/callouts/2.png" alt="2" border="0"></td><td valign="top" align="left"><p>The <tt>goto</tt> statement, interpreted by the DOS batch 36file interpreter, skips over the body of the Perl script.</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="c44b1b4b5b3b3"></a><img src="/images/callouts/3.png" alt="3" border="0"></td><td valign="top" align="left"><p>The <tt>require</tt> statement sources in external program 37fragments.</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="c44b1b4b5b3b4"></a><img src="/images/callouts/4.png" alt="4" border="0"></td><td valign="top" align="left"><p>The <tt>use</tt> statement is similar, but has additional 38utility. It is a Perl5 function. (Note that this callout area specifies 39both a line and a column.)</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="c44b1b4b5b3b5"></a><img src="/images/callouts/5.png" alt="5" border="0"></td><td valign="top" align="left"><p>This is a user subroutine call.</p></td></tr></table></div></div><p>The extensions are included in the distribution in 40<tt>extensions/nwalsh.jar</tt>. Just make sure that jar 41file is in your CLASSPATH when you run Saxon.</p><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a href="ch01s04.html">Prev</a> </td><td width="20%" align="center"><a href="index.html">Home</a></td><td width="40%" align="right"> <a href="ch02s02.html">Next</a></td></tr><tr><td width="40%" align="left">Customizing DocBook XSL stylesheets </td><td width="20%" align="center"><a href="index.html">Up</a></td><td width="40%" align="right"> Using the Extensions</td></tr></table></div></body></html>