public class PreparedStylesheet extends Executable implements Templates, Serializable
Modifier | Constructor and Description |
---|---|
protected |
PreparedStylesheet(Configuration config,
CompilerInfo info)
Constructor - deliberately protected
|
Modifier and Type | Method and Description |
---|---|
static PreparedStylesheet |
compile(Source source,
Configuration config,
CompilerInfo info)
Factory method to make a PreparedStylesheet
|
void |
explain(ExpressionPresenter presenter)
Produce an XML representation of the compiled and optimized stylesheet
|
void |
explainNamedTemplates(ExpressionPresenter presenter)
Explain the expression tree for named templates in a stylesheet
|
IAccumulatorManager |
getAccumulatorManager()
Get the class that manages accumulator functions
|
static Source |
getAssociatedStylesheet(Configuration config,
Source source,
String media,
String title,
String charset)
Get the stylesheet specification(s) associated
via the xml-stylesheet processing instruction (see
http://www.w3.org/TR/xml-stylesheet/) with the document
document specified in the source parameter, and that match
the given criteria.
|
PreparedStylesheet |
getCachedStylesheet(String href,
String baseURI)
Get a "next in chain" stylesheet.
|
CompilerInfo |
getCompilerInfo()
Get the CompilerInfo containing details of XSLT compilation options
|
DecimalFormatManager |
getDecimalFormatManager()
Get the DecimalFormatManager which handles decimal-format definitions
|
int |
getErrorCount()
Get the number of errors reported so far
|
Template |
getNamedTemplate(StructuredQName qName)
Get the named template with a given name.
|
Properties |
getOutputProperties()
Get the properties for xsl:output.
|
RuleManager |
getRuleManager()
Get the RuleManager which handles template rules
|
StyleNodeFactory |
getStyleNodeFactory()
Get the StyleNodeFactory in use.
|
boolean |
isCompileWithTracing()
Determine whether trace hooks are included in the compiled code.
|
Iterator<Template> |
iterateNamedTemplates()
Iterate over all the named templates defined in this Executable
|
DocumentImpl |
loadStylesheetModule(Source styleSource)
Build the tree representation of a stylesheet module
|
Transformer |
newTransformer()
Make a Transformer from this Templates object.
|
protected void |
prepare(Source styleSource)
Prepare a stylesheet from a Source document
|
void |
putCachedStylesheet(String href,
String baseURI,
PreparedStylesheet pss)
Save a "next in chain" stylesheet in compiled form, so that it can be reused repeatedly.
|
void |
putNamedTemplate(StructuredQName templateName,
Template template)
Register the named template with a given name
|
void |
reportError(TransformerException err)
Report a compile time error.
|
void |
reportWarning(TransformerException err)
Report a compile time warning.
|
void |
setAccumulatorManager(IAccumulatorManager accumulatorManager)
Set the class that manages accumulator functions
|
void |
setConfiguration(Configuration config)
Set the configuration in which this stylesheet is compiled.
|
void |
setDecimalFormatManager(DecimalFormatManager dfm)
Set the DecimalFormatManager which handles decimal-format definitions
|
void |
setRuleManager(RuleManager rm)
Set the RuleManager that handles template rules
|
protected void |
setStylesheetDocument(DocumentImpl doc)
Create a PreparedStylesheet from a supplied DocumentInfo
Note: the document must have been built using the StyleNodeFactory
|
void |
setUsesTunnelParameters()
Say that the stylesheet uses tunnel parameters.
|
boolean |
usesTunnelParameters()
Ask whether the stylesheet uses tunnel parameters.
|
addQueryLibraryModule, addQueryLocationHintProcessed, addRequiredParam, checkAllRequiredParamsArePresent, createsSecondaryResult, explainGlobalVariables, fixupQueryModules, getCharacterMapIndex, getCollationTable, getCompiledGlobalVariables, getConfiguration, getDefaultOutputProperties, getFunctionLibrary, getGlobalVariable, getGlobalVariableMap, getHostLanguage, getInitialContextItemVariableName, getKeyManager, getLargestPatternStackFrame, getLocationMap, getNamedCollation, getOutputProperties, getQueryLibraryModules, getQueryLibraryModules, getQueryModuleWithSystemId, getStripperRules, initializeBindery, isAllowXPath30, isQueryLocationHintProcessed, isSchemaAware, registerGlobalVariable, setCharacterMapIndex, setCollationMap, setCreatesSecondaryResult, setDefaultOutputProperties, setFunctionLibrary, setHostLanguage, setInitialContextItemVariableName, setKeyManager, setLocationMap, setOutputProperties, setPatternSlotSpace, setSchemaAware, setStripperRules, setStripsInputTypeAnnotations, setStripsWhitespace, stripsInputTypeAnnotations, stripsWhitespace
protected PreparedStylesheet(Configuration config, CompilerInfo info)
config
- The Configuration set up by the TransformerFactoryinfo
- Compilation optionspublic static PreparedStylesheet compile(Source source, Configuration config, CompilerInfo info) throws TransformerConfigurationException
source
- the source of this principal stylesheet moduleconfig
- the Saxon configurationinfo
- compile-time options for this stylesheet compilationTransformerConfigurationException
- if there is a static error in the stylesheetpublic Transformer newTransformer()
newTransformer
in interface Templates
Controller
public void setConfiguration(Configuration config)
setConfiguration
in class Executable
config
- the configuration to be used.public StyleNodeFactory getStyleNodeFactory()
public void setDecimalFormatManager(DecimalFormatManager dfm)
dfm
- the DecimalFormatManager containing the named xsl:decimal-format definitionspublic DecimalFormatManager getDecimalFormatManager()
public IAccumulatorManager getAccumulatorManager()
public void setAccumulatorManager(IAccumulatorManager accumulatorManager)
accumulatorManager
- the manager of accumulator functionspublic void setUsesTunnelParameters()
public boolean usesTunnelParameters()
protected void prepare(Source styleSource) throws TransformerConfigurationException
styleSource
- the source document containing the stylesheetTransformerConfigurationException
- if compilation of the
stylesheet fails for any reasonpublic DocumentImpl loadStylesheetModule(Source styleSource) throws XPathException
styleSource
- the source of the moduleXPathException
- if XML parsing or tree
construction failsprotected void setStylesheetDocument(DocumentImpl doc) throws XPathException
doc
- the document containing the stylesheet moduleXPathException
- if the document supplied
is not a stylesheetpublic void setRuleManager(RuleManager rm)
rm
- the RuleManager containing details of all the template rulespublic RuleManager getRuleManager()
public Template getNamedTemplate(StructuredQName qName)
qName
- The template namepublic void putNamedTemplate(StructuredQName templateName, Template template)
templateName
- the name of a named XSLT templatetemplate
- the templatepublic Iterator<Template> iterateNamedTemplates()
Template
public void explainNamedTemplates(ExpressionPresenter presenter)
presenter
- destination for the explanatory outputpublic boolean isCompileWithTracing()
public Properties getOutputProperties()
In Saxon, the properties object is a new, empty, Properties object that is backed by the live properties to supply default values for missing properties. This means that the property values must be read using the getProperty() method. Calling the get() method on the underlying Hashtable will return null.
In Saxon 8.x, this method gets the output properties for the unnamed output format in the stylesheet.
getOutputProperties
in interface Templates
Transformer.setOutputProperties(java.util.Properties)
public void reportError(TransformerException err) throws TransformerException
err
- the exception containing details of the errorTransformerException
- if the ErrorListener decides that the
error should be reportedpublic int getErrorCount()
public void reportWarning(TransformerException err)
err
- an exception holding details of the warning condition to be
reportedpublic PreparedStylesheet getCachedStylesheet(String href, String baseURI)
href
- the relative URI of the next-in-chain stylesheetbaseURI
- the baseURI against which this relativeURI is to be resolvedpublic void putCachedStylesheet(String href, String baseURI, PreparedStylesheet pss)
href
- the relative URI of the stylesheetbaseURI
- the base URI against which the relative URI is resolvedpss
- the prepared stylesheet object to be cachedpublic CompilerInfo getCompilerInfo()
public void explain(ExpressionPresenter presenter)
presenter
- defines the destination and format of the outputpublic static Source getAssociatedStylesheet(Configuration config, Source source, String media, String title, String charset) throws TransformerConfigurationException
config
- The Saxon Configurationsource
- The XML source document.media
- The media attribute to be matched. May be null, in which
case the prefered templates will be used (i.e. alternate = no).title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.TransformerConfigurationException
- if any problems occurCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.