XSLT files

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 types of XSLT files are used by the transformer:
  • Input XSLT files: These are used by the Probe for Message Bus to send events to the ObjectServer.
  • Output XSLT files: These are used by the Message Bus 2 gateway to send events from the ObjectServer.

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

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

$OMNIHOME/java/conf/cbe2nvpairs.xsl

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

$OMNIHOME/java/conf/netcool2cbe.xsl

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

$OMNIHOME/java/conf/netcool2nvpairs.xsl

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

$OMNIHOME/java/conf/netcool2scala.xsl

This XSLT file converts Netcool events into a format suitable for the target data collection application.

$OMNIHOME/java/conf/netcool2wef.xsl

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

$OMNIHOME/java/conf/netcool2json.xsl

This XSLT file converts Netcool events from the gateway into JavaScript Object Notation (JSON) events.

$OMNIHOME/java/conf/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.

$OMNIHOME/java/conf/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.

Gateway XSLT files

The input into a gateway XSLT file is an XML representation of an ObjectServer event. The output from this XSLT conversion must be in the format required by the target application. It can be an alternative XML format or a plain text string. You must determine which on an application-by-application basis.

The columns available within the XML are defined by the gateway mapping. The output is published by the gateway to the defined topic.