public class XSLProcessor
extends java.lang.Object
XSLStylesheet objects and to transform an input XML document using a previously constructed XSLStylesheet.| Modifier and Type | Class and Description |
|---|---|
static class |
XSLProcessor.XSLTVersion
Version class used in XSLProcessor.setXSLTVersion()
|
| Modifier and Type | Field and Description |
|---|---|
static XSLProcessor.XSLTVersion |
XSLT10
XSLTVersion for XSLT 1.0 specification.
|
static XSLProcessor.XSLTVersion |
XSLT20
XSLTVersion for XSLT 2.0 WD specification.
|
| Constructor and Description |
|---|
XSLProcessor()
Default Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getParam(java.lang.String name)
Deprecated.
- use getParam(String, String);
|
java.lang.Object |
getParam(java.lang.String uri, java.lang.String name)
Gets the value of a top-level stylesheet parameter.
|
XSLStylesheet |
newXSLStylesheet(java.io.InputStream xsl)
Constructs an XSLStylesheet using the given Inputstream XSL function document('') is not supported as there is no way to re-access the input Stylesheet as XMLDocument.
|
XSLStylesheet |
newXSLStylesheet(java.io.Reader xsl)
Constructs an XSLStylesheet using the given Reader XSL function document('') is not supported as there is no way to re-access the input Stylesheet as XMLDocument.
|
XSLStylesheet |
newXSLStylesheet(java.net.URL xsl)
Constructs an XSLStylesheet using the given URL
|
XSLStylesheet |
newXSLStylesheet(XMLDocument xsl)
Constructs an XSLStylesheet using the given XMLDocument
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, java.io.InputStream xml, java.net.URL ref)
Transform input XML document using given InputStream and stylesheet.
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, java.io.Reader xml, java.net.URL ref)
Transform input XML document using given Reader and stylesheet.
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, java.net.URL xml, java.net.URL ref)
Transform input XML document using given URL and stylesheet.
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, XMLDocument xml)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocument xml, ContentHandler handler)
Transform input XML document using given XMLDocument and stylesheet.
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, XMLDocumentFragment inp)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocumentFragment xml, java.io.OutputStream os)
Transform input XML using given XMLDocumentFragment and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocumentFragment xml, java.io.PrintWriter pw)
Transform input XML using given XMLDocumentFragment and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocumentFragment inp, XMLDocumentHandler handler)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocument xml, java.io.OutputStream os)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocument xml, java.io.PrintWriter pw)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLDocument xml, XMLDocumentHandler handler)
Transform input XML document using given XMLDocument and stylesheet.
|
XMLDocumentFragment |
processXSL(XSLStylesheet xsl, XMLElement inp)
Transform input XML document using given XMLDocument and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLElement inp, ContentHandler handler)
Transform input XML document using given XMLElement and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLElement xml, java.io.OutputStream os)
Transform input XML using given XMLElement and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLElement xml, java.io.PrintWriter pw)
Transform input XML using given XMLElement and stylesheet.
|
void |
processXSL(XSLStylesheet xsl, XMLElement xml, XMLDocumentHandler handler)
Transform input XML document using given XMLElement and stylesheet.
|
void |
removeParam(java.lang.String uri, java.lang.String name)
Removes the value of a top-level stylesheet parameter.
|
void |
resetParams()
Resets all the params set.
|
void |
setAttribute(java.lang.String name, java.lang.Object value)
Allows the user to set specific attributes on the underlying implementation.
|
void |
setBaseURL(java.net.URL url)
Set base url to resolve include/import hrefs EntityResolver if set is used before using the base url
|
void |
setEntityResolver(EntityResolver eResolver)
Set entity resolver to resolve include/import hrefs if not set, base url (if set) is used.
|
void |
setErrorStream(java.io.OutputStream out)
Creates an output stream for the output of warnings.
|
void |
setFunctionResolver(javax.xml.xpath.XPathFunctionResolver fresolver)
Set XPathFunctionResolver to resolve extension functions
|
void |
setLocale(java.util.Locale locale)
Applications can use this to set the locale for error reporting.
|
void |
setOutputEncoding(java.lang.String externalenc)
If output encoding is not specified in XSL document, output charset as "UTF-8" in META element by default.
|
void |
setParam(java.lang.String uri, java.lang.String name, java.lang.Object value)
Sets the value of a top-level stylesheet parameter.
|
void |
setXSLTVersion(XSLProcessor.XSLTVersion version)
Set the specification version to be used for transformation.
|
void |
showWarnings(boolean flag)
Switch to determine whether to output warnings.
|
public static final XSLProcessor.XSLTVersion XSLT10
public static final XSLProcessor.XSLTVersion XSLT20
public void setFunctionResolver(javax.xml.xpath.XPathFunctionResolver fresolver)
XPathFunctionResolver -public void processXSL(XSLStylesheet xsl, XMLDocument xml, ContentHandler handler) throws XSLException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)handler - ContentHandlerXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLDocument xml, XMLDocumentHandler handler) throws XSLException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)handler - XMLDocument handlerXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLDocument xml, java.io.OutputStream os) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)out - Outputstream to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic void processXSL(XSLStylesheet xsl, XMLDocument xml, java.io.PrintWriter pw) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)pw - PrintWriter to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic XMLDocumentFragment processXSL(XSLStylesheet xsl, XMLDocument xml) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)XMLDocumentFragmentXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLElement inp, ContentHandler handler) throws XSLException
xsl - XSLStylesheet to be used for transformationinp - XML input to be transformed (as a DOM Tree)handler - ContentHandlerXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLElement xml, XMLDocumentHandler handler) throws XSLException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)handler - XMLDocument HandlerXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLElement xml, java.io.OutputStream os) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)out - Outputstream to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic void processXSL(XSLStylesheet xsl, XMLElement xml, java.io.PrintWriter pw) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)pw - PrintWriter to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic XMLDocumentFragment processXSL(XSLStylesheet xsl, XMLElement inp) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)XMLDocumentFragmentXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLDocumentFragment inp, XMLDocumentHandler handler) throws XSLException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)handler - XMLDocument handlerXSLException - on error.public void processXSL(XSLStylesheet xsl, XMLDocumentFragment xml, java.io.OutputStream os) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)out - Outputstream to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic void processXSL(XSLStylesheet xsl, XMLDocumentFragment xml, java.io.PrintWriter pw) throws XSLException, java.io.IOException
xsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)pw - PrintWriter to which the result is printedXSLException, - IOException on error.XSLExceptionjava.io.IOExceptionpublic XMLDocumentFragment processXSL(XSLStylesheet xsl, XMLDocumentFragment inp) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a DOM Tree)XMLDocumentFragmentXSLException - on error.public XMLDocumentFragment processXSL(XSLStylesheet xsl, java.io.InputStream xml, java.net.URL ref) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a java.io.Inputstream)ref - Reference URL to resolve external entities in input xml fileXMLDocumentFragmentXSLException - on error.public XMLDocumentFragment processXSL(XSLStylesheet xsl, java.net.URL xml, java.net.URL ref) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a java.net.URL)ref - Reference URL to resolve external entities in input xml fileXMLDocumentFragmentXSLException - on error.public XMLDocumentFragment processXSL(XSLStylesheet xsl, java.io.Reader xml, java.net.URL ref) throws XSLException
xsl:output, to use xsl:output use processXSL functions which accept OutputStream or PrintWriterxsl - XSLStylesheet to be used for transformationxml - XML input to be transformed (as a java.io.Reader)ref - Reference URL to resolve external entities in input xml fileXMLDocumentFragmentXSLException - on error.public XSLStylesheet newXSLStylesheet(XMLDocument xsl) throws XSLException
xsl - XSL input as a DOM TreeXSLException - on error.public XSLStylesheet newXSLStylesheet(java.io.InputStream xsl) throws XSLException
xsl - XSL input as an InputstreamXSLException - on error.public XSLStylesheet newXSLStylesheet(java.net.URL xsl) throws XSLException
xsl - XSL input as a URLXSLException - on error.public XSLStylesheet newXSLStylesheet(java.io.Reader xsl) throws XSLException
xsl - XSL input as a ReaderXSLException - on error.
public void setAttribute(java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalArgumentException
name - The name of the attribute.value - The value of the attribute.java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
public final void setErrorStream(java.io.OutputStream out)
throws java.io.IOException
out - The output stream to use for errors and warningsjava.io.IOExceptionpublic void setLocale(java.util.Locale locale)
locale - Locale to setpublic final void showWarnings(boolean flag)
flag - determines whether warnings should be shown By default, warnings are not outputpublic void setBaseURL(java.net.URL url)
url - Base URL to be setsetEntityResolver(org.xml.sax.EntityResolver)public void setEntityResolver(EntityResolver eResolver)
eResolver - EntityResolver
public void setParam(java.lang.String uri,
java.lang.String name,
java.lang.Object value)
throws XSLException
uri - URI of parametername - parameter namevalue - parameter value (Strings will be treated as XPath Expr for backward compatibility)XSLException - on error
public java.lang.Object getParam(java.lang.String uri,
java.lang.String name)
throws XSLException
uri - URI of parametername - parameter nameXSLException - on error
public void removeParam(java.lang.String uri,
java.lang.String name)
throws XSLException
uri - URI of parametername - parameter nameXSLException - on error
public void resetParams()
throws XSLException
XSLException - on errorpublic void setOutputEncoding(java.lang.String externalenc)
externalenc - Externally specified Output encodingpublic void setXSLTVersion(XSLProcessor.XSLTVersion version)
public java.lang.Object getParam(java.lang.String name)
throws TransformerException,
java.io.IOException
name - the parameter namethe - parameter valueTransformerExceptionjava.io.IOException