|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jdom.transform.XSLTransform
This class serves as an interface to a TrAX aware XSLT processor such as Xalan or Saxon.
The following example shows how to apply an XSL Transformation to a JDOM document and get the transformation result in the form of another JDOM Document:
public static Document transform(Document in) throws XSLException { XSLTransform stylesheet = new XSLTransform("mystylesheet.xsl"); return stylesheet.transform(doc); }
JDOM relies on TrAX to perform the transfromation.
The javax.xml.transform.TransformerFactory
Java system property
determines which XSLT engine TrAX uses. Its value should be
the fully qualified name of the implementation of the abstract
javax.xml.transform.TransformerFactory
class.
Possible values of this property include:
com.icl.saxon.TransformerFactoryImpl
net.sf.saxon.TransformerFactoryImpl
org.apache.xalan.processor.TransformerFactoryImpl
jd.xml.xslt.trax.TransformerFactoryImpl
oracle.xml.jaxp.JXSAXTransformerFactory
This property can be set in all the usual ways a Java system property can be set. TrAX picks from them in this order:
System.setProperty( "javax.xml.transform.TransformerFactory",
"classname
")
classname
option to the java interpreterlib/jaxp.properties
properties file
in the JRE directory, in a line like this one:
javax.xml.parsers.DocumentBuilderFactory=classname
META-INF/services/javax.xml.transform.TransformerFactory
file
in the JAR archives available to the runtime
Constructor Summary | |
XSLTransform(Document stylesheet)
This will create a new XSLTransform by
reading the stylesheet from the specified
Document . |
|
XSLTransform(java.io.File stylesheet)
This will create a new XSLTransform by
reading the stylesheet from the specified
File . |
|
XSLTransform(java.io.InputStream stylesheet)
This will create a new XSLTransform by
reading the stylesheet from the specified
InputStream . |
|
XSLTransform(java.io.Reader stylesheet)
This will create a new XSLTransform by
reading the stylesheet from the specified
Reader . |
|
XSLTransform(java.lang.String systemID)
This will create a new XSLTransform by
reading the stylesheet from the specified URL. |
Method Summary | |
java.lang.Object |
clone()
This will create a copy of this XSLTransform object. |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
This returns the hash code for this XSLTransform . |
java.lang.String |
toString()
This returns a String form of this
XSLTransform , suitable for debugging. |
Document |
transform(Document in)
This will create a new Document from the
input Document by applying this object's
stylesheet. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XSLTransform(java.io.InputStream stylesheet) throws XSLException
This will create a new XSLTransform
by
reading the stylesheet from the specified
InputStream
.
stylesheet
- InputStream
from which the stylesheet is read.XSLException
- when an IOException, format error, or
something else prevents the stylesheet from being compiledpublic XSLTransform(java.io.Reader stylesheet) throws XSLException
This will create a new XSLTransform
by
reading the stylesheet from the specified
Reader
.
stylesheet
- Reader
from which the stylesheet is read.XSLException
- when an IOException, format error, or
something else prevents the stylesheet from being compiledpublic XSLTransform(java.io.File stylesheet) throws XSLException
This will create a new XSLTransform
by
reading the stylesheet from the specified
File
.
stylesheet
- File
from which the stylesheet is read.XSLException
- when an IOException, format error, or
something else prevents the stylesheet from being compiledpublic XSLTransform(Document stylesheet) throws XSLException
This will create a new XSLTransform
by
reading the stylesheet from the specified
Document
.
stylesheet
- Document
containing the stylesheet.XSLException
- when the supplied Document
is not syntactically correct XSLTpublic XSLTransform(java.lang.String systemID) throws XSLException
This will create a new XSLTransform
by
reading the stylesheet from the specified URL.
systemID
- URL from which the stylesheet is read.XSLException
- when an IOException, format error, or
something else prevents the stylesheet from being compiledMethod Detail |
public Document transform(Document in) throws XSLException
This will create a new Document
from the
input Document
by applying this object's
stylesheet. The original Document
is not
changed.
in
- Document
to transform.XSLException
- if the transformation fails, normally
due to an XSLT error.public java.lang.Object clone()
This will create a copy of this XSLTransform
object.
To be honest, I can't imagine why you'd want to do this.
This class is thread-safe. Perhaps this mthod should be deleted?
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
This returns the hash code for this XSLTransform
.
hashCode
in class java.lang.Object
int
- hash code.public java.lang.String toString()
This returns a String
form of this
XSLTransform
, suitable for debugging.
toString
in class java.lang.Object
String
- debugging string.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |