XSLT

 

Configuration and Testing. PAGEREF _Toc225255062 \h 2

Interaction Configurations. PAGEREF _Toc225255063 \h 2

Attributes. PAGEREF _Toc225255064 \h 3

Use Mapper to define transformation. PAGEREF _Toc225255065 \h 3

Transformation source data. PAGEREF _Toc225255066 \h 3

Set transformation result as. PAGEREF _Toc225255067 \h 4

Mappings. PAGEREF _Toc225255068 \h 4

XSL. PAGEREF _Toc225255069 \h 6

JMS-Message XSL. PAGEREF _Toc225255070 \h 7

Xslt Engine. PAGEREF _Toc225255071 \h 10

Strip White Spaces. PAGEREF _Toc225255072 \h 11

Fail transformation on error PAGEREF _Toc225255073 \h 13

Optimization. PAGEREF _Toc225255074 \h 13

Testing the Interaction Configurations. PAGEREF _Toc225255075 \h 14

Functional Demonstration. PAGEREF _Toc225255076 \h 15

Scenario 1. PAGEREF _Toc225255077 \h 15

Use Case Scenario. PAGEREF _Toc225255078 \h 16

Useful Tips. PAGEREF _Toc225255079 \h 17

 

The XSLT component allows user to configure source and target document structures using Fiorano Mapper and create a XSL used for transforming documents. Alternatively, it allows users to define XSL created using external tools. Documents passed to the component are transformed using the XSL defined.

Configuration and Testing

Interaction Configurations

The configuration for XSLT is defined in the Interactions Configurations panel as shown in Figure 1.

Figure 1: Interaction Configurations panel with expert view enabled

TOP

Attributes

Error Handling Configuration

Click on the ellipsis button against Error Handling Configuration property to configure Error Handling properties.

Figure 2: Error Handling Configuration

The remedial actions to be taken when a particular error occurs can be configured here.

The default actions configured are:

Use Mapper to define transformation

This property determines the means of defining XSL that is used for transformation.

●    yes 

When this value is selected property Mappings is visible and property XSL is made expert. Fiorano Mapper is used to define transformation. 

●    no 

When this value is selected property Mappings is not visible and property XSL is visible as a normal property. Fiorano Mapper cannot be used to define transformation and XSL for transformation has to be manually provided.

Note:

Changing this value from yes to no does the following changes

Any mappings previously defined using Fiorano Mapper will have to be redone. However the XSL(s) computed from mappings and set against properties XSL and JMS-Message XSL will still be present and can be used for transformation if the property value for property Transformation source data is not changed. If the value for property Transformation source data is automatically changed it should be reverted back manually.

Changing the value back to yes does not restore the value of property Mappings and removes values for properties XSL and JMS-Message XSL. These XSL(s) have to be redefined.

TOP

Transformation source data

This property determines the source for XML instance(s) from the input message on which XSL transformation should be applied for generating output XML. The source for XML instance(s) can be:

●    Body

The transformation is applied to XML instance that is taken from the message body of the input message. Input structure in Fiorano Mapper contains the XSD/DTD defined for message body (same as structure on the input port of the component).

●    Context

The transformation is applied to XML instance that is taken from the application context property of input message. Input structure in Fiorano Mapper contains the XSD/DTD defined for application context.

●    Context-Body

The transformation is applied to XML instances that are taken from both message body and application context property of input message. Input structure in Fiorano Mapper contains XSD/DTD defined for application context as well as XSD/DTD for input body.

Note: In this case, XML instance of application context is treated as primary source. Elements in primary source can be referenced directly in XSL, where as elements of other structure should be referenced as document (<StructureName>)/<ElementName>.

TOP

Set transformation result as

This property determines where the result of transformation of source data using XSL is set in the output message.

●    Body

The result of the transformation is set as message body on the output message.

●    Context

The result of the transformation is set as the application context property of the output message.

TOP

Mappings

The property defines the Fiorano Mapper project (contents of .tmf file) that can be created using Fiorano Mapper. XSL required for transformation is created automatically based on the mappings defined in Fiorano Mapper.  Click the ellipsis button  to open the Fiorano Mapper tool for visually defining the XSL.

Figure 2: Launching Fiorano Mapper

Every time the Fiorano Mapper is closed after saving the mappings defined, XSL(s) computed using the mappings defined are set against the properties XSL and JMS-Message XSL. Any previously set XSL(s) content against these properties are overwritten.

Loading input and output structures in Fiorano Mapper

-         Previously configured structure, if the component is already configured using Fiorano Mapper. If the structure defined on the output port of other component connected to input port of this component is changed, it is logged in the Messages window in Fiorano Mapper, but the previously configured structure is retained.

-         One of the structures on other component's output port which is connected to this component's input port, if the component is not previously configured using Fiorano Mapper.

-         No structures, if the component is not previously configured and the component's input port is not connected to any other component's output port which has a structure defined. In such a case, structure can be loaded manually either by typing in/copying the structure or from a file system.

-         Structure defined for application context in Event Process. If application context structure is changed after the previous configuration, then the new structure is loaded.

-         Default application context structure (<!ELEMENT Context (#PCDATA)>) if application context structure is not defined.

-         Structure for application context as described for the case where Transformation source data is set to Context.

-         Structure for message body as described for the case where Transformation source data is set to Body.

-         Previously configured structure, if the component is already configured using Fiorano Mapper. If the structure defined on the input port of other component connected to output port of this component is changed, it is logged in the Messages window in Fiorano Mapper, but the previously configured structure is retained.

-         One of the structures on other component's input port which is connected to this component's output port, if the component is not previously configured using Fiorano Mapper.

-         No structures, if the component is not previously configured and the component's output port is not connected to any other component's input port which has a structure defined. In such a case, structure can be loaded manually either by typing in/copying the structure or from a file system.

-         Structure defined for application context in Event Process. If application context structure is changed after the previous configuration, then the new structure is loaded.

-         Default application context structure (<!ELEMENT Context (#PCDATA)>) if application context structure is not defined.

Note: When the structure is changed, mappings for nodes that are not at same Xpath location before and after the change is discarded.

TOP

XSL

This property defines the XSL that is used to transform source data from source defined against property Transformation source data to required output that is set on target defined against property Set transformation result as. When the value for property Use Mapper to define transformation is set to yes this value is automatically populated after defining mappings in Fiorano Mapper. When the value for property Use Mapper to define transformation is set to no, XSL should be manually provided here.

Note: If the XSL contains any custom java functions, jar files containing such functions should be added as resources to XSLT component.

TOP

JMS-Message XSL

This property defines the XSL that is used to transform source data from source defined against property Transformation source data to required interim XML which defines JMS message properties and text that has to be  set. The component parses this interim XML and sets the required JMS properties and their values on the output message. When the value for property Use Mapper to define transformation is set to yes this value is automatically populated after defining mappings in Fiorano Mapper. When the value for property Use Mapper to define transformation is set to no, XSL which generates XML corresponding to structure shown in Figure 3 should be manually provided here.

Figure 4: Structure of XML which is result of applying JMS-Message XSL

Note: JMS properties can be set alternatively using JMS Message Functions in Funclet tab of Fiorano Mapper.

Defining JMS-Message XSL using Fiorano Mapper

                Figure 5: Loading JMS-Message structure on output

 

                Figure 6: JMS-Message Structure loaded on output

Note: type can values Byte, Short, Integer, Long, Float, Double, Boolean. Any other value defined for type is treated as String type.

 

                Figure 7: Mappings for defining a String property with name "FileName" and value "samplefile.txt"

                Figure 8: Duplicating Property node

                Figure 9: Setting message body

Note: When content is mapped to Text element of JMS-Message structure and Set transformation result as property is set to Body, content mapped to Text element of JMS-Message structure takes precedence of result of transformation and the body of output message contains content mapped to Text element of JMS-Message structure.

TOP

Xslt Engine

This property along with Transformer factory class property when this property's value is Other determines the transformer implementation that should be used to perform the transformation.

Xalan (2.7.0) and Saxon (8.4) transformer implementations are bundled with Fiorano environment for performing transformations.

Xalan implementation (org.apache.xalan.processor.TransformerFactoryImpl) is used to perform transformation.

Note: Xalan (2.7.0) does not support XSLT 2.0

Saxon implementation (net.sf.saxon.TransformerFactoryImpl) is used to perform transformation.

Note: Saxon implementation does not support custom functions

This option should be used when a custom transformer implementation has to be used. Selecting this option shows property Transformer factory class which can be used to provide the transformation factory implementation that should be used.

Transformer factory class

This property determines the fully qualified name of the class which should be used to perform transformation when the transformer implementation other than that is provided by Saxon or Xalan has to be used. The class provided should be an implementation of javax.xml.transform.TransformerFactory.

Resources (jar files) containing the java class specified against this property should be added as resources to XSLT component.

TOP

Strip White Spaces

This property determines whether elements in input XML which have only whitespace content should be stripped of the content unconditionally before the transformation is done.

Note: This property works only with Saxon.

Attribute to strip whitespace is not set at all. Behavior dependents on the transformer's implementation. For Saxon implementation shipped with Fiorano the behavior is same as that of False.

Whitespace content is stripped from input XML before the transformation is done.

Whitespace content is retained as it is.

Example: Figure 10 shows a sample transformation defined.

                Figure 10: Sample transformation

Xslt Engine is chosen as Saxon and Strip White Spaces property is set to True as shown in Figure 10. Input XML in Figure 10 contains Title element which has whitespace.

Figure 11: Saxon engine with Strip White Spaces set to True

Input XML, shown in Figure 12, contains only whitespace for element Title. After the transformation train element of output XML does not whitespace though there is a simple mapping from input XML's Title element.

Figure 12: Input XML with whitespace in element Title and output XML without whitespace for train

TOP

Fail transformation on error

This property determines how the problems that occur during the transformation have to be handled. There are three levels of problems that can occur during the transformation. Warnings, errors, and fatal errors

TOP

Optimization

This property determines whether some internal structures can be cleared so as to make some additional memory available for transformation.

When property Set transformation result as is set to Body, message body is cleared from input message after message body is loaded into input for transformer and before transformation begins. In this case, Text-Content and Byte-Content functions of JMS Message functions in Fiorano Mapper (shown in Figure 13) cannot be used.

Figure 13: JMS Message functions in Fiorano Mapper

When property Set transformation result as is set to Context, content in application context is cleared from input message after content in application context is loaded into input for transformer and before transformation begins.

Note: This property comes into effect only when there is no JMS-Message XSL defined.

TOP

Functional Demonstration

Scenario 1

The scenario demonstrates a simple XSLT mapping. In this mapping,

Configure the XSLT component as described in Configuration and Testing section and use feeder and display component to send sample input and check the response respectively.

Figure 14: Mapping used

 

Figure 15: Demonstrating scenario 1 with sample input and sample output

TOP

Use Case Scenario

In EAI Demo sample, XSLT is used in extracting the Email ID, Order ID from the input XML and some mappings are defined between them with the POP3 schema elements and to construct the message body.

Figure 16: Sample use-case scenario

The Event Process demonstrating this scenario is bundled with the installer.

Documentation of the scenario and instructions to run the flow can be found in the Help tab of flow when open in Studio.

TOP

Useful Tips

Suitable JDBC drivers required for Lookup functions have to be added as Service Dependencies or as Resources to XSLTFunctions System Lib.

TOP

Copyright © 1999-2008, Fiorano Software Technologies Pvt. Ltd. All rights reserved.

Copyright © 2008-2009, Fiorano Software Pty. Ltd. All rights reserved.

This software is the confidential and proprietary information of Fiorano Software ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement enclosed with this product or entered into with Fiorano.