com.saxonica
Class CompileStylesheet

java.lang.Object
  extended by com.saxonica.CompileStylesheet

public class CompileStylesheet
extends Object

This CompileStylesheet class provides a command-line interface allowing a stylesheet to be compiled.

Author:
Michael H. Kay, Saxonica

Nested Class Summary
static class CompileStylesheet.TracingObjectOutputStream
          Tracing version of ObjectOutputStream for diagnostics
 
Constructor Summary
CompileStylesheet()
           
 
Method Summary
protected  void applyLocalOptions(CommandLineOptions options, Configuration config)
          Customisation hook: apply options defined locally in a subclass
protected  void badUsage(String message)
          Output error message when incorrect command line options/arguments are used
protected  void compileStylesheet(Configuration config, String styleFileName, String outputFileName, boolean useURLs)
          Compile the stylesheet from a given input file to an output file
protected  void doMain(String[] args)
          Support method for main program.
static void main(String[] args)
          Main program, can be used directly from the command line.
protected static void quit(String message, int code)
          Exit with a message
 void setPermittedOptions(CommandLineOptions options)
          Set the options that are recognized on the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompileStylesheet

public CompileStylesheet()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Main program, can be used directly from the command line.

The format is:

java net.sf.saxon.Compile [options] style-file output-file

This program compiles the XSL style sheet in style-file to the output-file.

Parameters:
args - Arguments supplied on the command line
Throws:
Exception - Any compilation error occurs

setPermittedOptions

public void setPermittedOptions(CommandLineOptions options)
Set the options that are recognized on the command line. This method can be overridden in a subclass to define additional command line options.

Parameters:
options - the CommandLineOptions in which the recognized options are to be registered.

doMain

protected void doMain(String[] args)
Support method for main program. This support method can also be invoked from subclasses that support the same command line interface

Parameters:
args - the command-line arguments

compileStylesheet

protected void compileStylesheet(Configuration config,
                                 String styleFileName,
                                 String outputFileName,
                                 boolean useURLs)
                          throws TransformerException
Compile the stylesheet from a given input file to an output file

Parameters:
config - The Saxon configuration
styleFileName - input stylesheet file
outputFileName - compiled stylesheet file
useURLs - true if filenames are to be interpreted as URLs
Throws:
TransformerException - in the event of failure

applyLocalOptions

protected void applyLocalOptions(CommandLineOptions options,
                                 Configuration config)
Customisation hook: apply options defined locally in a subclass

Parameters:
options - the CommandLineOptions
config - the Saxon Configuration

quit

protected static void quit(String message,
                           int code)
Exit with a message

Parameters:
message - Message to be output
code - Result code to be returned to the operating system

badUsage

protected void badUsage(String message)
Output error message when incorrect command line options/arguments are used

Parameters:
message - Error message to be displayed


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.