Given an XML document and an XSLT or JSP template, transforms and outputs the XML document.
Class Name |
|
---|---|
Component |
|
Required Input Parameters
None
Optional Input Parameters
input
The XML document to transform, either the URL for an XML document, DOM document object, or SAX InputSource
or a text InputStream
. If omitted, the open parameter unset
executes.
validate
Determines whether the parser should validate this document against the DTD specified in the input
parameter. Options include:
true: Read the DTD, validate the document, and apply all information from the DTD.
false (default): Read the DTD, do not validate the document, but substitute default attributes, and apply other information from the DTD at the parser’s discretion (Apache Xerces supports this mode).
nodtd
: Do not read the DTD, validate the document, or apply any defaults or other information. Use this mode when you do not want the parser to try and resolve the DTD location, perhaps because the remote URL location is temporarily unreachable. The resulting document might be incomplete, might have incorrect attribute values, and does not have substitution of external entities. (Apache Xerces supports this mode, but it might not be available for every parser).
If the XML document lacks a DTD, you must omit this parameter.
template
The template to use to transform the XML document. This can be either an XSLT template or a JSP. Both absolute paths and relative paths are accepted.
passParams
When the template is an XSL stylesheet, sets a flag to control the passing of parameters from the request and servlet bean environment, to top-level <xsl:param>
elements in the XSL stylesheet. Set to one of the following values:
none
: no parameters are passed (default)query
: URL query parameters from aGET
requestpost
: form parameters from aPOST
requestlocal
: only parameters in this servlet bean scopeall
: parameters from all servlet bean and request scopes
If more than one parameter exists for a given name, only the first is passed. The order of parameter scopes is from local (within the XMLTransform servlet bean), up through other enclosing scopes, and eventually to the request query or post parameters.
documentParameterName
The name of the parameter to which the input DOM Document is bound when using a JSP template. The default value is inputDocument
.
Output Parameters
documentOuputName
Set to the DOM document that results from the transformation. The default is document.
errors
Set to an enumeration of Exceptions if failures occurred when transforming the XML document.
Open Parameters
unset
Rendered if the input
parameter is omitted.
output
Rendered when the XML document is transformed. If the output
open parameter is specified, the document is not automatically output in the JSP.
failure
Rendered when the XML document cannot be transformed.
Usage Notes
XMLTransform lets you transform XML documents with a template. The template can be either an XSLT template or a JSP. The document to transform is specified by the input
parameter. The template to apply is determined in the following order of precedence:
Template input parameter of the XMLTransform servlet bean
Mapping specified in the
XMLTemplateMap
ComponentDefault template specified in the
XMLTemplateMap
ComponentXSL stylesheet directive embedded in the XML source document