XMLTransformation node

This topic contains the following sections:

Purpose

Use the XMLTransformation node to transform an XML message to another form of XML message, according to the rules provided by an XSL (eXtensible Stylesheet Language) stylesheet.

You can specify the location of the stylesheet to apply to this transformation in one of three ways:

  1. You can use node properties. This ensures that the transformation defined by this single stylesheet is applied to every message processed by this node.
  2. You can use the content of the XML data within the message itself. This transforms the message according to a stylesheet that the message itself defines.
  3. You can set a value within the LocalEnvironment folder associated with the message. This provides a dynamic choice of stylesheet, because you must set this value (in a Compute node) within the message flow after receipt of the message. You can therefore use a variety of inputs to determine which stylesheet to use for this message, such as the content of the message data or a value in a database.

The XMLTransformation node is represented in the workbench by the following icon:

XMLTransformation node icon

Using this node in a message flow

For an example of how to use this node, consider two news organizations that exchange information on a regular basis. One might be a television station, the other a newspaper. Although the information is similar, the vocabulary used by the two is different. This node can transform one format to the other by applying the rules of the specified stylesheet. If you specify the stylesheet in the message (either the XML data or the LocalEnvironment), the same node can perform both transformations.

Configuring the XMLTransformation node

When you have put an instance of the XMLTransformation node into a message flow, you can configure it. Right-click the node in the editor view and click Properties. The node's basic properties are displayed.

All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk on the properties dialog.

Configure the XMLTransformation node as follows:

  1. Select values for the XML Embedded Selection Priority, Message Environment Selection Priority, and WBI Brokers Node Attribute Selection Priority properties. The values that you set determine the order in which alternative locations are searched for the stylesheet information. The highest priority setting is 1. The default order is:
    1. XML Embedded Selection Priority, which therefore has a default value of 1. The node searches the XML data for stylesheet location information. For example, the XML data might contain:
      <xml-stylesheet type="text/xsl" href="foo.xsl">
    2. Message Environment Selection Priority, which therefore has a default value of 2. The node searches the LocalEnvironment associated with the current message for the stylesheet information stored in an element called ComIbmXslXmltStylesheetname.

      Because this node was available in a SupportPac for Version 2.1, and element ComIbmXslMqsiStylesheetname was used for the stylesheet name, the current node checks both elements. If both are present, the value in ComIbmXslXmltStylesheetname takes precedence.

    3. WBI Brokers Node Attribute Selection Priority, which therefore has a default value of 3. The node uses the node properties Stylesheet Name and Stylesheet Directory to determine the correct values.

    You can set more than one property to the same value, although this is not recommended. If you do, the order of priority set by the node is the default order indicated above.

    If you set a value of 0, the node does not search the corresponding location for the stylesheet identification. If you set all three properties to 0, a runtime error is generated.

  2. If you want to specify the stylesheet using node properties, enter the required value for Stylesheet Name. This value is ignored if stylesheet information is searched for and found in a preferred location (determined by the selection priority values that you have set).
  3. If the stylesheet identification is fully qualified, Stylesheet Directory is ignored; if it is not, the value that you set in this property is added to the beginning of the specification, regardless of where it is found.
  4. In Stylesheet Cache Level, specify the number of compiled or parsed stylesheets that are stored in this instance of the node. The default value is 5. The stylesheet cache is retained for the life of the node. It is cleared when the node is deleted from the flow, or when the flow is deleted, or when the execution group is stopped. If you modify a stylesheet, the modified (latest) version is used in preference to the cached version. If you want to refresh the cache, use the mqsireload command.
  5. Select Output Character Set in the properties dialog navigator to specify the order in which the node searches valid locations to find the character set to use for the output message. The highest priority setting is 1. The default order is:
    1. Message Environment Selection Priority, which therefore has a default value of 1. The node searches the LocalEnvironment associated with the current message for the character set information stored in an element called ComIbmXslXmltOutputcharset.

      For example, to encode the output of the transformation as UTF-8, enter the value 1208 as a string in this element.

      Because this node was available in a SupportPac for Version 2.1, and element ComIbmXslMqsiOutputcharset was used for the output character set, the current node checks both elements. If both are present, the value in ComIbmXslXmltOutputcharset takes precedence.

    2. WBI Brokers Node Attribute Selection Priority, which therefore has a default value of 2. The node uses the property Output Character Set to determine the correct value.

      If you set a value for Output Character Set, the value that you enter must be numeric. For example, to encode the output of the transformation as UTF-16, enter 1200.

    You can set more than one property to the same value, although this is not recommended. If you do, the order of priority set by the node is the default order indicated above.

    If you set a value of 0, the node does not search the corresponding location for the character set identification.

    If the node cannot determine the output character set from either of these two sources, either because no value is set or because the selection priorities are set to 0, the default value 1208 (UTF8) is used. (The XSL specification indicates that the output character set can be specified in the stylesheet; however, the XMLTransformation node ignores this value.)

  6. Select Detail Trace in the properties dialog navigator to trace the actions of the XMLTransformation node. The default value for the Detail Trace property is Off. To activate trace, set the property to On.

    The trace information is written to a trace file XMLTTrace.log:

    • On z/OS systems, the file is located in <broker_dir>/output, where <broker_dir> is the directory in which you have installed the broker
    • On Windows systems, the file is located in <install_dir>\bin
    • On UNIX systems, the file is located in the directory in which your message broker has been started.

    where <install_dir> is the directory in which you have installed WebSphere Business Integration Message Broker.

    If you set detailed trace on for one XMLTransformation node, it is on for all nodes in the execution group.

  7. Select Description in the properties dialog navigator to enter a short description, a long description, or both.
  8. Click Apply to make the changes to the XMLTransformation node without closing the properties dialog. Click OK to apply the changes and close the properties dialog.

    Click Cancel to close the dialog and discard all the changes that you have made to the properties.

Terminals and properties

The XMLTransformation node terminals are described in the following table.

Terminal Description
In The input terminal that accepts the message for processing by the node.
Failure The output terminal to which the original message is routed if an error is detected during transformation.
Out The output terminal to which the successfully transformed message is routed.

The following tables describe the node properties; the column headed M indicates whether the property is mandatory (marked with an asterisk on the properties dialog if you must enter a value when no default is defined), the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the bar file to deploy it).

The XMLTransformation node Stylesheet properties are described in the following table.

Property M C Default Description
XML Embedded Selection Priority Yes No 1 The priority value for searching for stylesheet location information in the XML data.
Message Environment Selection Priority Yes No 2 The priority value for searching for stylesheet location information in the LocalEnvironment folder of the current message.
WBI Brokers Node Attribute Selection Priority Yes No 3 The priority value for searching for stylesheet location information as a property of the node
Stylesheet Name No Yes   The name of the stylesheet, used if the stylesheet specification is searched for in node properties.
Stylesheet Directory No Yes   The path where the stylesheet is located. Used by all location methods.
Stylesheet Cache Level No No 5 The number of compiled or parsed stylesheets that are stored in this instance of the node.

The XMLTransformation node Output Character Set properties are described in the following table.

Property M C Default Description
Message Environment Selection Priority Yes No 1 The priority value for searching for the Output Character Set ID in the LocalEnvironment folder of the current message.
WBI Brokers Node Attribute Selection Priority Yes No 2 The priority value for searching for the Output Character Set ID as a property of the node.
Output Character Set No No   The numeric value of the Output Character Set

The XMLTransformation node Detail Trace properties are described in the following table.

Property M C Default Description
Trace Setting Yes No Off Whether tracing is on or off. If tracing is on, low level tracing is recorded in a file.

The XMLTransformation node Description properties are described in the following table.

Property M C Default Description
Short Description No No   A brief description of the node.
Long Description No No   Text that describes the purpose of the node in the message flow.

Related concepts
Message flows
LocalEnvironment tree

Related tasks
Deciding which nodes to use
Handling errors in message flows
Editing configurable properties

Related reference
mqsireload command
Compute node