Setting a field to a fixed value using the XSLT mediation primitive

The XSLT mediation primitive in WebSphere ESB allows you to perform XSL transformations which you compose using the XML mapping tool. A common question is how to set a particular field, typically a string, to a fixed value. In order to do this you need to do the following:

  • Right click on the target element you want to set to be a fixed value and select Define XSLT Function
  • In the XSLT Functions dialog that appears choose a function of string
  • Click the Add button and enter a string value surrounded by single quotes and click OK. Your dialog should now look like:

XSLT Functions Dialog

  • Select Finish

For reference, this is equivalent to the XSLT:

<xsl:value-of select=”string(‘FIXED_VALUE’)”/>

Typically you would only do this if you have some other need to perform an XSLT transformation as the Message Element Setter mediation primitive is designed to perform precisely this task. The advantage of using a Message Element Setter to do this is that you can then use promoted properties to modify this fixed value post deployment.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: