The servlet bean XMLTransform (/atg/dynamo/droplet/xml/XMLTransform) lets you use templates to transform XML documents. The template can be an XSLT template or a JSP. The document to transform, accessible as a URL, DOM document, or input stream, is specified by the servlet bean’s input parameter.

You can specify the template to use in several ways. The ATG platform uses the template specified according to the following order of precedence:

  1. The input parameter template that is set by the XMLTransform servlet bean.

  2. The global XMLTemplateMap Component—specified by the xmlTemplateMap property of the component/atg/dynamo/droplet/xml/XMLTransform —which defines a mapping from document type to template, or from URL to template.

  3. A globally defined default template, specified by the defaultTemplate property of the XMLTemplateMap Component.

  4. The template defined by the XML document itself, using an embedded xmlstylesheet processing instruction.

For more details on the embedded xmlstylesheet directive, see the specification at http://www.w3.org/TR/xml-stylesheet. An XSL directive must have a recognized XSL type, such as text/xml or text/xsl, to distinguish it from CSS stylesheet directives. If the source document contains multiple XSL directives, the stylesheets are concatenated before the transformation is applied. If you want an embedded stylesheet directive to take effect, the xmlTemplateMap must not produce a match. You can achieve this by setting the xmlTemplateMap property to null, or having an empty match table and empty default value.

In the case of a JSP template, the XMLTransform servlet bean passes a DOM document as a parameter local to the execution of the JSP. The name of this parameter can be controlled by the XMLTransform servlet bean parameter documentParameterName.

The transformation yields a DOM object that is bound to the document parameter. The name of this parameter can be controlled by the XMLTransform parameter documentOutputName.

Unless you specify otherwise with the output parameter, XMLTransform outputs the transformed document to the page.

 
loading table of contents...