|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.xsl.Stylesheet
An XSLT stylesheet.
The following is the basic procedure to programmatically create and use an XSLT stylesheet (see
com.novell.xsl.nxsl
for a command-line driver):
1. Obtain a DOM tree of the stylesheet. For example, use com.novell.xml.parser.XMLParserFactory.newParser()
to create a parser that will return a DOM tree.
2. Construct a Stylesheet
object based on the DOM tree. This will construct a "compiled"
version of the stylesheet.
3. Obtain a DOM tree of the source document to be transformed. If the source document is
serialized and needs to be parsed, use com.novell.xsl.SAXtoDOMStrip
to convert from SAX
events to a DOM tree and perform whitespace stripping based on the stylesheet. This is more
efficient than performing source tree whitespace stripping at processing time.
4. Setup a ResultHandler
in the Stylesheet
object. If a ResultHandler
is not explicitly specified
the Stylesheet
will use com.novell.xsl.result.DOMResultHandler
which will build a DOM tree from
the XSLT result document. To obtain the result document as a series of SAX events use
com.novell.xsl.result.SAXResultHandler
. To serialize the result document use
com.novell.xsl.result.DefaultSerializer
, com.novell.xsl.result.XMLSerializer
, or
com.novell.xsl.result.HTMLSerializer
. A custom result handler may be used by implementing
com.novell.xsl.result.ResultHandler
.
5. Transform the source document by calling Stylesheet.process()
.
By default, errors are reported to System.err
but processing continues. This behavior can be changed
by installing a custom error handler that implements com.novell.xsl.ErrorHandler
. Call
Stylesheet.setErrorHandler()
.
By default xsl:message
elements output their content as serialized XML to System.out
. This behavior can be
changed by installing a custom message handler that implements com.novell.xsl.MessageHandler
.
Call Stylesheet.setMessageHandler()
.
Custom character encodings can be implemented by deriving the implementation from com.novell.io.CharEncoder
.
The custom encoding can then be specified using the encoding attribute on the xsl:output
element.
com.novell.xsl.parser.StylesheetParser
is used to construct the stylesheet from the DOM input tree.
ErrorHandler
,
MessageHandler
,
ResultHandler
,
DOMResultHandler
,
SAXResultHandler
,
DefaultSerializer
,
StylesheetParser
,
CharEncoder
,
nxsl
Field Summary | |
static String |
EXTENSION_FUNCTION_MAGIC
The start of the URI used to signify extension functions and non-built in extension elements: "http://www.novell.com.nxsl/java/" |
static NamespaceName |
NAMESPACE
The URI for the XSLT namespace. |
static NamespaceName |
NXSL_NAMESPACE
The URI for NXSL built-in extension elements: "http://www.novell.com/nxsl" |
static String |
VERSION
The version number for this processor |
static String |
XSLT_VERSION
The version of XSLT supported by this Stylesheet ( "1.0" ) |
Constructor Summary | |
Stylesheet()
Constructs an empty XSLT stylesheet with the default XSLT function library (extension functions are available). |
|
Stylesheet(ClassLoader extensionFunctionLoader)
Constructs an empty XSLT stylesheet with the default XSLT function library (extension functions are available). |
|
Stylesheet(ClassLoader extensionFunctionLoader,
Map properties)
Constructs an empty XSLT stylesheet with the default XSLT function library (extension functions are available). |
|
Stylesheet(Document xslDocument)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
boolean brokenMode)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
boolean brokenMode,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
ClassLoader extensionFunctionLoader)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
ClassLoader extensionFunctionLoader,
boolean brokenMode)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
ClassLoader extensionFunctionLoader,
boolean brokenMode,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
ClassLoader extensionFunctionLoader,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree. |
|
Stylesheet(Document xslDocument,
String xslURI)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
boolean brokenMode)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
boolean brokenMode,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
ClassLoader extensionFunctionLoader)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
ClassLoader extensionFunctionLoader,
boolean brokenMode)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
ClassLoader extensionFunctionLoader,
boolean brokenMode,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
ClassLoader extensionFunctionLoader,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Document xslDocument,
String xslURI,
Map properties)
Constructs an XSLT stylesheet from the specified XML document tree; the specified filename is used to resolve resolve relative URIs in the stylesheet. |
|
Stylesheet(Map properties)
Constructs an empty XSLT stylesheet with the default XSLT function library (extension functions are available). |
Method Summary | |
void |
clearParameters()
clear existing stylesheet parameters |
void |
dump(PrintWriter out)
Dumps this object to the specified output stream. |
void |
dump(PrintWriter out,
int indent)
Dumps this object to the specified output stream. |
NamespaceName |
getAliasedNamespace(NamespaceName alias)
Return the result namespace given an alias, if any |
String |
getAliasedPrefix(NamespaceName alias)
Return the result namespace prefix given an alias, if any |
AttributeSet |
getAttributeSet(ExpandedQName setName)
Get an attribute set definition with a particular expanded name |
URL |
getBaseURI()
Returns this stylesheet's base URI. |
Context |
getContext()
Get the base ExpressionContext used by this Stylesheet |
DecimalFormatSymbols |
getDecimalFormat(ExpandedQName name)
Get an xsl:decimal-format declared number-formatting object |
ErrorHandler |
getErrorHandler()
Returns the error handler to which this stylesheet reports processing errors and warnings. |
String |
getID()
Returns the ID identifying this stylesheet. |
Key |
getKey(ExpandedQName name)
Return a key with a given expanded name |
MessageHandler |
getMessageHandler()
Returns the message handler for xsl:message output |
ResultHandler |
getResultHandler()
Get the result handler that is used for the result tree |
SerializerOptions |
getSerializerOptions()
Get the serializer options, if any |
OutputStream |
getSerializerStream()
Get the output stream that will be used for serialization of the result tree |
StripList |
getStripList()
Returns this stylesheet's whitespace stripping element list |
RuleCollection |
getTemplateRules()
Returns this stylesheet's collection of template rules. |
TopLevelVariableTemplate |
getTopLevelVariable(ExpandedQName name)
Return a top-level variable given its name |
Expression |
getVariable(ExpandedQName varName)
Return an object of type Expression given an ExpandedQName name.
|
XmlHook |
getXmlHook()
Return any document processing hook set for this instance. |
boolean |
isLoaded()
Return true if this stylesheet has been loaded (i.e., load() or loadFromSource()
was successfully called). |
void |
load(Document xslDocument)
Loads this XSLT stylesheet from the specified XML document tree. |
void |
loadFromSource(Document xmlDocument,
String documentURI)
Attempt to load this XSLT stylesheet object from a source document containing one or more xml-stylesheet processing instructions.
|
void |
process(Node sourceDocument,
URL sourceURI)
Processes the specified source document with this stylesheet. |
void |
process(Node sourceDocument,
URL sourceURI,
boolean alreadyStripped)
Processes the specified source document with this stylesheet. |
void |
processStripped(Node sourceDocument,
URL sourceURI)
Processes the specified source document with this stylesheet. |
void |
registerResetCache(XPathResetCache reset)
Register an instance of XPathResetCache so
it will be called when the source document changes |
void |
setAttributeSet(AttributeSet attributeSet)
Set an attribute set created from an xsl:attribute-set element
This will handle merging with any existing attribute sets with the same name |
void |
setBaseURI(String uri)
Sets this stylesheet's base URI to a URL. |
void |
setBaseURI(URL baseURI)
Sets this stylesheet's base URI to the specified URL. |
boolean |
setBrokenMode(boolean newMode)
Set this Stylesheet object to use broken but backwards-compatible behavior. |
void |
setDecimalFormat(ExpandedQName name,
DecimalFormatSymbols decimalFormat)
Set an xsl:decimal-format declared number-formatting object |
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the error handler to which this stylesheet reports processing errors and warnings. |
void |
setID(String id)
Sets this stylesheet's ID. |
void |
setKey(Key key)
Set a Key in the stylesheet |
void |
setMessageHandler(MessageHandler messageHandler)
Sets the error handler to which this stylesheet reports processing errors and warnings. |
void |
setMimeTypes(String[] mimeTypes)
Set the mime types that will be recognized in xml-stylesheet processing instructions. |
void |
setNamespaceAlias(NamespaceName alias,
NamespaceName resultName,
String resultPrefix,
int importance)
Set a namespace alias for a namespace in the result tree |
void |
setParameter(String paramName,
Object value)
set a stylesheet parameter |
void |
setParameter(String paramName,
String expressionString)
set a stylesheet parameter |
void |
setResultHandler(ResultHandler resultHandler)
Set the result handler for the result tree |
void |
setSerializerOptions(SerializerOptions serializerOptions,
int importance)
Set serializer options. |
void |
setSerializerStream(OutputStream serializerStream)
Set the stream for use by a serializer. |
void |
setTopLevelVariable(TopLevelVariableTemplate variable)
Set a top-level variable for this stylesheet Normally, this would only be called by the stylesheet parser. |
XmlHook |
setXmlHook(XmlHook hook)
Set a processing hook for processing XML documents loaded via xsl:include, xsl:import, or the XSLT document() function. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final NamespaceName NAMESPACE
"http://www.w3.org/1999/XSL/Transform"
)
public static final String VERSION
public static final NamespaceName NXSL_NAMESPACE
"http://www.novell.com/nxsl"
public static final String EXTENSION_FUNCTION_MAGIC
"http://www.novell.com.nxsl/java/"
public static final String XSLT_VERSION
"1.0"
)
Constructor Detail |
public Stylesheet()
load()
to "compile" a stylesheet document.
load(org.w3c.dom.Document)
,
setBaseURI(java.net.URL)
public Stylesheet(Map properties)
load()
to "compile" a stylesheet document.
properties
- Map containing extended propertiesload(org.w3c.dom.Document)
,
setBaseURI(java.net.URL)
public Stylesheet(ClassLoader extensionFunctionLoader)
load()
to "compile" a stylesheet document.
extensionFunctionLoader
- ClassLoader to use for loading
extension functions.load(org.w3c.dom.Document)
,
setBaseURI(java.net.URL)
public Stylesheet(ClassLoader extensionFunctionLoader, Map properties)
load()
to "compile" a stylesheet document.
extensionFunctionLoader
- ClassLoader to use for loading
extension functions.properties
- Map containing extended propertiesload(org.w3c.dom.Document)
,
setBaseURI(java.net.URL)
public Stylesheet(Document xslDocument) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
xslDocument
- the XML document tree for the XSLT stylesheet
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, Map properties) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
xslDocument
- the XML document tree for the XSLT stylesheetproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, boolean brokenMode) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetbrokenMode
- if true
then use broken but backwards-compatible behavior
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, boolean brokenMode, Map properties) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetbrokenMode
- if true
then use broken but backwards-compatible behaviorproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, ClassLoader extensionFunctionLoader) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
xslDocument
- the XML document tree for the XSLT stylesheetextensionFunctionLoader
- ClassLoader to use for loading
extension functions.
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, ClassLoader extensionFunctionLoader, Map properties) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
xslDocument
- the XML document tree for the XSLT stylesheetextensionFunctionLoader
- ClassLoader to use for loading
extension functions.properties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, ClassLoader extensionFunctionLoader, boolean brokenMode) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetextensionFunctionLoader
- ClassLoader to use for loading
extension functions.brokenMode
- if true
then use broken but backwards-compatible behavior
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, ClassLoader extensionFunctionLoader, boolean brokenMode, Map properties) throws XSLException
null
. Note that a valid, non-null
base URI is needed to
properly resolve relative URIs in the stylesheet.
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetextensionFunctionLoader
- ClassLoader to use for loading
extension functions.brokenMode
- if true
then use broken but backwards-compatible behaviorproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI) throws XSLException
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URI
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, Map properties) throws XSLException
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, boolean brokenMode) throws XSLException
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIbrokenMode
- if true
then use broken but backwards-compatible behavior
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, boolean brokenMode, Map properties) throws XSLException
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIbrokenMode
- if true
then use broken but backwards-compatible behaviorproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, ClassLoader extensionFunctionLoader) throws XSLException
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIextensionFunctionLoader
- ClassLoader to use for loading
extension functions.
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, ClassLoader extensionFunctionLoader, Map properties) throws XSLException
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIextensionFunctionLoader
- ClassLoader to use for loading
extension functions.properties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, ClassLoader extensionFunctionLoader, boolean brokenMode) throws XSLException
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIextensionFunctionLoader
- ClassLoader to use for loading
extension functions.brokenMode
- if true
then use broken but backwards-compatible behavior
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
public Stylesheet(Document xslDocument, String xslURI, ClassLoader extensionFunctionLoader, boolean brokenMode, Map properties) throws XSLException
This overload allows broken but backwards-compatible behavior to be specified.
xslDocument
- the XML document tree for the XSLT stylesheetxslURI
- the XSLT document's URIextensionFunctionLoader
- ClassLoader to use for loading
extension functions.brokenMode
- if true
then use broken but backwards-compatible behaviorproperties
- Map containing extended properties
XSLException
- if a fatal parsing error occursStylesheet()
,
setBaseURI(String)
,
load(org.w3c.dom.Document)
Method Detail |
public Context getContext()
public boolean setBrokenMode(boolean newMode)
newMode
- the new broken mode (if true, then broken but backwards-compatible
behavior is used).
public void setResultHandler(ResultHandler resultHandler)
resultHandler
- The result handler to use.public ResultHandler getResultHandler()
null
if the setResultHandler() has not been called, and
process() has not been called.public void setSerializerStream(OutputStream serializerStream)
serializerStream
- The output stream to use for serializationpublic OutputStream getSerializerStream()
public void setParameter(String paramName, String expressionString)
paramName
- The QName of the parameter to setexpressionString
- A String containing an XPath expression
The expression will be evaluation just before source document
processing beginspublic void setParameter(String paramName, Object value)
paramName
- The QName of the parameter to setvalue
- The object containing the parameter value.public void clearParameters()
public XmlHook setXmlHook(XmlHook hook)
hook
- interface to call upon document load (may be null).
public XmlHook getXmlHook()
public URL getBaseURI()
null
if the base
URI is unknownpublic void setBaseURI(URL baseURI)
The XSLT processor needs a non-null
base URI in order to properly resolve
relative URIs in the stylesheet (such as the href=
attribute in xsl:import
). The base URI is initially set to
null
.
baseURI
- this stylesheet's base URI, or null
if the
base URI is unknownpublic void setBaseURI(String uri) throws MalformedURLException
file:
scheme and the current directory
"."
The XSLT processor needs a non-null
base URI in order to properly resolve
relative URIs in the stylesheet (such as the href=
attribute in xsl:import
). The base URI is initially set to
null
.
uri
- the uri string from which the base URI is to be
constructed
MalformedURLException
- if a URL cannot be formed from the specified filenamepublic String getID()
null
if it has no IDpublic void setID(String id)
null
.
id
- the ID for this stylesheetpublic RuleCollection getTemplateRules()
public StripList getStripList()
public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the error handler to which this stylesheet reports
processing errors and warnings
IllegalArgumentException
- if errorHandler is null
public MessageHandler getMessageHandler()
public void setMessageHandler(MessageHandler messageHandler)
messageHandler
- the message handler to which this stylesheet reports
xsl:message output
IllegalArgumentException
- if messageHandler is null
public SerializerOptions getSerializerOptions()
null
if no options have
been set.public void setSerializerOptions(SerializerOptions serializerOptions, int importance)
serializerOptions
- A SerializerOptions object with any
serializer options desired.importance
- The import precedence associated with the options
(higher numbers more important)public void setTopLevelVariable(TopLevelVariableTemplate variable) throws XSLException
variable
- The variable for this stylesheet
XSLException
public TopLevelVariableTemplate getTopLevelVariable(ExpandedQName name)
null
if none found by passed namepublic void setDecimalFormat(ExpandedQName name, DecimalFormatSymbols decimalFormat)
name
- The expanded name of the decimal-format object (null
indicates
the default decimal-format object)decimalFormat
- The DecimalFormatSymbols object containing the decimal-format
attributes.public DecimalFormatSymbols getDecimalFormat(ExpandedQName name)
name
- The expanded name of the decimal-format object (null
indicates the
default decimal-format)
public void setKey(Key key)
key
- The Key to addpublic Key getKey(ExpandedQName name)
name
- The expanded name of the Key
null
otherwisepublic void setAttributeSet(AttributeSet attributeSet) throws XSLException
xsl:attribute-set
element
This will handle merging with any existing attribute sets with the same name
attributeSet
- The AttributeSet
object
XSLException
public AttributeSet getAttributeSet(ExpandedQName setName)
setName
- The expanded name of the attribute set to retrievepublic void setNamespaceAlias(NamespaceName alias, NamespaceName resultName, String resultPrefix, int importance)
alias
- The namespace name used in the stylesheetresultName
- The namespace name which replaces the alias in the result treeresultPrefix
- The prefix to use in the result tree (typically the same prefix as
used in the stylesheet)importance
- The import precedence of the declaring xsl:namespace-alias elementpublic NamespaceName getAliasedNamespace(NamespaceName alias)
alias
- The namespace alias used in the stylesheet
null
if no namespace is mapped
to the passed aliaspublic String getAliasedPrefix(NamespaceName alias)
alias
- The namespace alias used in the stylesheet
null
if passed alias
not mapped to a result tree namespacepublic void setMimeTypes(String[] mimeTypes)
mimeTypes
- An array of strings, each of which is a mime type ("text/xml", etc.)public void load(Document xslDocument) throws XSLTParserException
xslDocument
- an XML document tree representing an XSLT stylesheet
XSLTParserException
- if a fatal parsing error occurs or this stylesheet
has already been loadedpublic void loadFromSource(Document xmlDocument, String documentURI) throws XSLTParserException
xml-stylesheet
processing instructions.
This method will not use stylesheets that are specified as alternates.
xmlDocument
- The xmlDocument from which the xml-stylesheet
processing instructions
will be obtained.documentURI
- The base URI of the passed XML document, if known (may be null).
XSLTParserException
public boolean isLoaded()
load()
or loadFromSource()
was successfully called). This is necessary because the error handler may not
throw an exception if load()
or loadFromSource()
fails.
public void processStripped(Node sourceDocument, URL sourceURI) throws XSLException
Processes the specified source document with this stylesheet. This
stylesheet remains unaffected by the processing, so it can be reused to
process additional source documents. This method should only be used if
the passed source document has already been whitespace-stripped (for example,
by using SAXtoDOMStrip
).
sourceDocument
- the source document to be processed. Note that
this may be either a Document
or DocumentFragment
since XSLT relaxes the
restrictions on the source tree when the document is created by means other
than parsing a well-formed XML document.
The result of the processing depends on what type of result handler is
set using setResultHandler()
. If no result handler is set explicitly, then
a DOMResultHandler
is used. The resulting document can be retrieved by
calling ((DOMResultHandler)stylesheet.getResultHandler()).getDocument();
sourceURI
- the source document base URI, if it exists
XSLException
- if a fatal error occurs during processing
or if processing terminated early. The error condition
can be checked by calling XSLException.isError()
load(org.w3c.dom.Document)
public void process(Node sourceDocument, URL sourceURI) throws XSLException
sourceDocument
- the source document to be processed. Note that
this may be either a Document
or DocumentFragment
since XSLT relaxes the
restrictions on the source tree when the document is created by means other
than parsing a well-formed XML document.
The result of the processing depends on what type of result handler is
set using setResultHandler()
. If no result handler is set explicitly, then
a DOMResultHandler
is used. The resulting document can be retrieved by
calling ((DOMResultHandler)stylesheet.getResultHandler()).getDocument();
sourceURI
- the source document base url, if it exists
XSLException
- if a fatal error occurs during processing
or if processing terminated early. The error condition
can be checked by calling XSLException.isError()
load(org.w3c.dom.Document)
public void process(Node sourceDocument, URL sourceURI, boolean alreadyStripped) throws XSLException
sourceDocument
- the source document to be processed. Note that
this may be either a Document
or DocumentFragment
since XSLT relaxes the
restrictions on the source tree when the document is created by means other
than parsing a well-formed XML document.
The result of the processing depends on what type of result handler is
set using setResultHandler()
. If no result handler is set explicitly, then
a DOMResultHandler
is used. The resulting document can be retrieved by
calling ((DOMResultHandler)stylesheet.getResultHandler()).getDocument();
sourceURI
- the source document base url, if it existsalreadyStripped
- If true
, no runtime whitespace stripping will occur, which is faster
XSLException
- if a fatal error occurs during processing
or if processing terminated early. The error condition
can be checked by calling XSLException.isError()
load(org.w3c.dom.Document)
public void dump(PrintWriter out)
out
- the output stream o write topublic void dump(PrintWriter out, int indent)
out
- the output stream to write toindent
- number of tabs to indentpublic void registerResetCache(XPathResetCache reset)
XPathResetCache
so
it will be called when the source document changes
registerResetCache
in interface XPathResetRegistrar
reset
- The object implementing XPathResetCache
public Expression getVariable(ExpandedQName varName)
Expression
given an ExpandedQName
name.
Note that this will always return non-null
because if a name is not bound, it is
assumed to be a top-level variable whose definition has not yet been encountered. The parser
will fixup the top level variable placeholders after the last node in the stylesheet tree
is encountered.
getVariable
in interface VariableBindings
varName
- The name of the variable
Expression
object bound to passed name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |