|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.icl.saxon.trax.Processor | +--com.icl.saxon.StyleSheet
This StyleSheet class is the entry point to the Saxon XSLT Processor. This class is provided to control the processor from the command line; it also implements the TRAX Processor interface.
The XSLT syntax supported conforms to the W3C XSLT 1.0 and XPath 1.0 recommendation. Only the transformation language is implemented (not the formatting objects). Saxon extensions are documented in the file extensions.html
Field Summary | |
protected Emitter |
messageEmitter
|
protected NamePool |
namePool
|
protected org.xml.sax.XMLReader |
sourceParser
|
protected java.lang.String |
sourceParserName
|
protected URIResolver |
sourceURIResolver
|
protected org.xml.sax.XMLReader |
styleParser
|
protected java.lang.String |
styleParserName
|
protected URIResolver |
styleURIResolver
|
protected TraceListener |
traceListener
|
Constructor Summary | |
StyleSheet()
|
Method Summary | |
protected void |
badUsage(java.lang.String name,
java.lang.String message)
|
protected void |
doMain(java.lang.String[] args,
StyleSheet app,
java.lang.String name)
Support method for main program. |
org.xml.sax.InputSource[] |
getAssociatedStylesheets(org.xml.sax.InputSource source,
java.lang.String media,
java.lang.String title,
java.lang.String charset)
Get InputSource specification(s) that are associated with the given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria. |
boolean |
getFeature(java.lang.String name)
Look up the value of a feature. |
TemplatesBuilder |
getTemplatesBuilder()
Get a TemplatesBuilder object that can process SAX events into a Templates object, if the processor supports the "http://xml.org/trax/features/sax/input" feature. |
org.xml.sax.XMLReader |
getXMLReader()
Get the XML parser used for the templates. |
static void |
main(java.lang.String[] args)
Main program, can be used directly from the command line. |
static Emitter |
makeMessageEmitter(java.lang.String className)
|
static TraceListener |
makeTraceListener(java.lang.String className)
|
static URIResolver |
makeURIResolver(java.lang.String className)
|
Templates |
process(org.xml.sax.InputSource source)
Process the source stylesheet into a templates object. |
void |
processDirectory(java.io.File sourceDir,
PreparedStyleSheet sheet,
java.io.File outputDir,
ParameterSet params)
Process each file in the source directory using the same supplied stylesheet |
void |
processDirectoryAssoc(java.io.File sourceDir,
java.io.File outputDir,
ParameterSet params)
Process each file in the source directory using its own associated stylesheet |
void |
processFile(org.xml.sax.InputSource source,
PreparedStyleSheet sheet,
java.io.File outputFile,
ParameterSet params)
Process a single file using a supplied stylesheet |
void |
processFileAssoc(org.xml.sax.InputSource sourceInput,
java.lang.String localName,
java.io.File outputFile,
ParameterSet params)
Process a single source file using its associated stylesheet(s) |
Templates |
processFromNode(org.w3c.dom.Node node)
Process the stylesheet from a DOM tree, if the processor supports the "http://xml.org/trax/features/dom/input" feature. |
Templates |
processMultiple(org.xml.sax.InputSource[] sources)
Process a series of stylesheet inputs, treating them in import or cascade order. |
protected static void |
quit(java.lang.String message)
Exit with a message |
void |
setFeature(java.lang.String name,
boolean value)
Set the state of a feature. |
void |
setXMLReader(org.xml.sax.XMLReader reader)
Set an XML parser for the stylesheet. |
Methods inherited from class com.icl.saxon.trax.Processor |
getErrorHandler, getURIResolver, newInstance, setErrorHandler, setPlatformDefaultProcessor, setURIResolver |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String sourceParserName
protected java.lang.String styleParserName
protected org.xml.sax.XMLReader sourceParser
protected org.xml.sax.XMLReader styleParser
protected URIResolver sourceURIResolver
protected URIResolver styleURIResolver
protected Emitter messageEmitter
protected TraceListener traceListener
protected NamePool namePool
Constructor Detail |
public StyleSheet()
Method Detail |
public static void main(java.lang.String[] args) throws java.lang.Exception
The format is:
java com.icl.saxon.StyleSheet [options] source-file style-file >output-file
followed by any number of parameters in the form {keyword=value}... which can be referenced from within the stylesheet.
This program applies the XSL style sheet in style-file to the source XML document in source-file.
protected void doMain(java.lang.String[] args, StyleSheet app, java.lang.String name)
args
- the command-line argumentsapp
- instance of the StyleSheet class (or a subclass) to be invokedname
- name of the class, to be used in error messagesprotected static void quit(java.lang.String message)
public void processDirectoryAssoc(java.io.File sourceDir, java.io.File outputDir, ParameterSet params) throws java.lang.Exception
public void processFileAssoc(org.xml.sax.InputSource sourceInput, java.lang.String localName, java.io.File outputFile, ParameterSet params) throws java.lang.Exception
public void processDirectory(java.io.File sourceDir, PreparedStyleSheet sheet, java.io.File outputDir, ParameterSet params) throws java.lang.Exception
public void processFile(org.xml.sax.InputSource source, PreparedStyleSheet sheet, java.io.File outputFile, ParameterSet params) throws java.lang.Exception
protected void badUsage(java.lang.String name, java.lang.String message)
public static URIResolver makeURIResolver(java.lang.String className) throws org.xml.sax.SAXException
public static TraceListener makeTraceListener(java.lang.String className) throws org.xml.sax.SAXException
public static Emitter makeMessageEmitter(java.lang.String className) throws org.xml.sax.SAXException
public Templates process(org.xml.sax.InputSource source) throws ProcessorException
process
in class Processor
source
- An object that holds a URL, input stream, etc. for the stylesheetProcessorException
- May throw this during the parse when it
is constructing the Templates object and fails.public Templates processFromNode(org.w3c.dom.Node node) throws ProcessorException
processFromNode
in class Processor
node
- A DOM tree which must contain
valid transform instructions that this processor understands.public Templates processMultiple(org.xml.sax.InputSource[] sources) throws ProcessorException
processMultiple
in class Processor
sources
- An array of SAX InputSource objects.public org.xml.sax.InputSource[] getAssociatedStylesheets(org.xml.sax.InputSource source, java.lang.String media, java.lang.String title, java.lang.String charset) throws ProcessorException
Note that DOM2 has its own mechanism for discovering stylesheets. Therefore, there isn't a DOM version of this method.
getAssociatedStylesheets
in class Processor
media
- The media attribute to be matched. May be null, in which
case the prefered templates will be used (i.e. alternate = no).
TODO: ### if media is null, all stylesheets are returned, alternate is not used ###title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.public TemplatesBuilder getTemplatesBuilder() throws ProcessorException
getTemplatesBuilder
in class Processor
May
- throw a ProcessorException if a TemplatesBuilder
can not be constructed for some reason.public void setXMLReader(org.xml.sax.XMLReader reader)
setXMLReader
in class Processor
public org.xml.sax.XMLReader getXMLReader()
getXMLReader
in class Processor
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getFeature
in class Processor
name
- The feature name, which is a fully-qualified
URI. The only names recognized are
"http://xml.org/trax/features/dom/input" and
"http://xml.org/trax/features/sax/input", and in both cases
the value is always true.org.xml.sax.SAXNotRecognizedException
- When the
Processor does not recognize the feature name.org.xml.sax.SAXNotSupportedException
- When the
Processor recognizes the feature name but
cannot determine its value at this time.public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setFeature
in class Processor
name
- The feature name, which is a fully-qualified
URI. The only names recognized are
"http://xml.org/trax/features/dom/input" and
"http://xml.org/trax/features/sax/input", and in both cases
the only permitted value is true.state
- The requested state of the feature (true or false).org.xml.sax.SAXNotRecognizedException
- When the
Processor does not recognize the feature name.org.xml.sax.SAXNotSupportedException
- When the
Processor recognizes the feature name but
cannot set the requested value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |