Using XSLT files to transform events

Each XML event source generates events in a format that is specified by its own XML schema. You create an Extensible Stylesheet Language Translation (XSLT) file to transform events from that event source to another XML format, making it possible for applications to share XML events.

The following table shows the XSLT files that are supplied with the transformer module.

Table 1. XSLT files supplied with the transformer module
XSLT file Description

addnvpairs.xsl

This XSLT file is a support template. For details see Probe XSLT files.

cbe2nvpairs.xsl

This XSLT file converts Common Base Event (CBE) events into name-value pairs for the probe to read.

netcool2cbe.xsl

This XSLT file converts a Netcool® event into an event in CBE format.

netcool2nvpairs.xsl

This XSLT file converts Netcool events into name-value pairs that the probe can read.

u20002nvpairs.xsl

This XSLT file converts U2000 events into name-value pairs.

netcool2wef.xsl

This XSLT file converts Netcool events from the gateway into Web Services Distributed Management (WSDM) Event Format (WEF) events.

wbe2nvpairs.xsl

This XSLT file converts WebSphere® Business Event (WBE) events into name-value pairs for the probe to read.

wbepl2nvpairs.xsl

This XSLT file includes wbm2nvpairs.xsl for handling WebSphere Business Monitoring (WBM) events that are contained within WBE events.

wbm2nvpairs.xsl

This example XSLT file contains support XSLT match functions for handling specific WBM trade array event elements.

wef2nvpairs.xsl

This XSLT file converts WEF events into name-value pairs for the probe to read.

If you require other types of XSLT files, you must create them. The following topics provide information that will help you to create XSLT files.

For details of the syntax required for XSLT files, see the XSL Transformations page on the W3C Web site:

http://www.w3.org/TR/xslt

Probe XSLT files

The input can be any XML message that is to be inserted into the ObjectServer. This type of XSLT file must generate a set of name-type-value elements in the following format:

name:type:"value"

where:
  • name consists of alphanumeric characters and underscores.
  • type can be string, utc, or integer.
  • value is any arbitrary string that does not include a new-line character.

The module is supplied with an XSLT template, addnvpairs.xsl, that you must include in your XSLT file. You can call the template as a function, providing the function with the name, type, and value, to format the output correctly. To use the support template, include the XSLT file using the following XSLT include directive:

<xsl:include href="addnvpair.xsl"/>

Note: The href parameter for the file is relative to the location of the XSLT file that is including it. All XSLT files supplied with the module are installed in the same directory. If the XSLT file that you create is not in the same directory, you must specify the relative path to the support template within the href parameter. The module is supplied with a basic name-value pair XSLT file (netcool2nvpairs.xsl) which converts a Netcool XML event into a name-value pair for consumption by the probe.
The following example shows the content of the netcool2nvpairs.xsl with the include directive highlighted:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		version="1.0"
		xmlns:tns="http://item.tivoli.ibm.com/omnibus/netcool/nvpairs"
		xmlns:ens="http://item.tivoli.ibm.com/omnibus/netcool"
		exclude-result-prefixes="tns ens">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>

<xsl:include href="addnvpair.xsl"/>

<xsl:template match="/">
	<xsl:for-each select="ens:netcoolEvent">
		<xsl:call-template name="AddNVPair">
			<xsl:with-param name="name">
				<xsl:text>NetcoolEventAction</xsl:text>
			</xsl:with-param>
			<xsl:with-param name="type">
				<xsl:text>string</xsl:text>
			</xsl:with-param>
			<xsl:with-param name="value">
				<xsl:value-of select="@type"/>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:apply-templates/>
	</xsl:for-each>
</xsl:template>

<xsl:template match="ens:netcoolEvent/ens:netcoolField">
	<xsl:call-template name="AddNVPair">
		<xsl:with-param name="name">
			<xsl:value-of select="@name"/>
		</xsl:with-param>
		<xsl:with-param name="type">
			<xsl:value-of select="@type"/>
		</xsl:with-param>
		<xsl:with-param name="value">
			<xsl:value-of select="."/>
		</xsl:with-param>
	</xsl:call-template>
</xsl:template>

</xsl:stylesheet>
Within this example there are two other directives that you should include in all probe XSLT files:
  • <xsl:output method="text"/>

    This sets the XSLT to plain text, rather than the default of XML. As the output is required in name-type-value elements, it must be in plain text.

  • <xsl:strip-space elements="*"/>

    This directive forces all unessential whitespace to be stripped from the output.

For additional guidance about creating XSLT files for use with the Message Bus Probe, see the following Tech Note: http://www-01.ibm.com/support/docview.wss?uid=swg21622274