Page tree
Skip to end of metadata
Go to start of metadata

Summary: this page provides information about how the JEE Analyzer handles STXX (Struts for Transforming XML with XSL)

Note that the CAST Script / FlexFramework feature described in this page is deprecated. You should instead consider using the Extension SDK to handle XML configuration files.


STXX (Struts for Transforming XML with XSL) support is provided by processing its configuration file commonly called stxx-transforms.xml.

This file can be associated with an XML Query File (with STXX 1.1 and 1.2 in plug-in mode). In this case, the object created for the file will have the XML Configuration File type. This is the case for all files that have this association. However, this is not the recommended way if you use STXX above struts and plan to associate the struts configuration file with the default cast-config.xml file. Indeed, this file contains instructions specifying how to find STXX files and what information to retrieve.

The analyzer transforms definitions in three ways according to the STXX version you are using:

1: STXX 1.0 (struts 1.0)

In this version, configuration information required by the framework is located in the Struts configuration file. Hence, each transform definition is placed beneath a forward definition as shown below:

<action path="/contactListExample" type="com.oroad.stxx.example.ContactListExampleAction" scope="request">
	<forward name="success">
		<transform name="default" path="/contactListExample.xsl"/>

In this case, queries required to process this information are placed in the same file as those dealing with struts-config.xml. An STXX Transform object named "default" (in this example) is then created beneath the Forward object and the value of the @path attribute is resolved as a URL.

The queries corresponding to this should look like this:

<object-node xpath="./forward[transform]" name="./@name" type="forward">
	<object-node xpath="./transform" name="./@name" type="stxx-transform">
		<link-node xpath="." called-object="./@path" resolve-as="url" />

2: STXX 1.1 (struts 1.1)

Version 1.1 provides, in addition to the way transforms are defined in version 1.0, another mode known as plug-in mode. In this mode, transforms are defined in an external file (stxx-transforms.xml). The struts-config.xml file references the transforms file using a <plug-in> element as follows:

<plug-in className="com.oroad.stxx.plugin.StxxPlugin" >
	<set-property property="transform-config" value="/WEB-INF/stxx-transforms.xml" />

Since this code is in the struts configuration file, a <config-file-node> element that points to the <plug-in> node should be used in the Queries File to retrieve the transforms file path. Objects (only Transforms) and links to be created can then be specified using the <object-node> and <link-node> elements beneath <config-file-node> (within the same Queries File):

<config-file-node xpath="./struts-config/plug-in/set-property[@property='transform-config']" content-type="stxx-transforms" 
location="./@value" version="1.1">
	<object-node xpath="./transform-definitions/transform" 
	name="./@name" type="stxx-transform">
		<link-node xpath="." called-object="./xsl/file/@name" resolve-as="url"/> 

Transforms are defined this way (in stxx-transforms.xml):

	<transform name="addressBookExample.dox">
		<xsl selector="default">
			<file name="/addressBookExample.xsl"/>
		<xsl selector="MSIE">
			<file name="/addressBookExample_IE.xsl"/>

For each Transform, a link is traced toward the corresponding file (called-object="./xsl/file/@name" resolve-as="url"). A link is also created between Forwards whose @path attribute value ends with ".dox" and the Transform whose name matches this value.

3: STXX 1.2

Version 1.2 works with the two modes seen above. The difference resides in the transforms file format. Indeed, Transforms are defined within Pipelines (a type of pattern) as follows:

	<pipeline match="simple/*.dox">
		<transform type="html">
			<param name="path" value="/{1}.xsl" />

In this case, the J2EE Analyzer will always create a Pipeline object with the @match attribute value (i.e. "simple/*.dox") for name. For a Transform to be created beneath the pipeline, it needs first to be referenced (i.e. by the @path attribute of a <forward> element in struts-config.xml) and secondly, its associated file should exist physically. This file's path is given by the value of @value attribute of the <param> sub element. This value is not usable as is. Indeed, it contains place holders (digits from 1 to 9) that should be expended using the reference string. The code below gives an example of a reference of the transform defined above.

<action path="/index"
	<forward name="success" path="simple/index.dox"/>

To resolve the reference string simple/index.dox, the Analyzer first looks for a Pipeline that matches simple/index.dox. The Pipeline of the example does match this string with the * corresponding to index.

  • Each * in the Pipeline name represents a character string without "/".
  • Each ** in the Pipeline name represents a characters string including "/".
  • Each matched string (using both * or **) is referenced within the transform definition using a digit that corresponds to its occurrence order in the Pipeline's name.
  • In the code <param name="path" value="/{1}.xsl" /> the 1 will be matched with the string index leading to <param name="path" value="/index.xsl"/>.

So, if the file /index.xsl is found, then the following objects/links will be created:

  • A Transform named simple/index.dox (beneath the Pipeline object)
  • An eFile object to represent the called file (/index.xsl)
  • A link from the Transform toward the eFile.
  • A link from the Forward toward the Transform.
  • <param> elements that are taken into account are those having a @name attribute set to "path", "page" or "xform".
  • Configuration for all three STXX versions is done in the default cast-config.xml file.
  • No labels