This project has moved. For the latest updates, please go here.

Xml file lookup

Summary

This transform allows for the lookup of values in an XML file using an XPath expression.

Lookup transforms are used to find the incoming value in a table, and replace it with another value.

If the incoming value is not found in the lookup table, you can specify what you want the transform to return instead. You can choose between returning nothing, returning the original value, or a fixed default value

Parameters

Parameter Description
File The full path to the XML file
XPath expression A XPath expression that is used to locate the replacement value. Use the declaration{attributeValue} in the expression, and it will be substituted with the incoming value to search for
When no match is found If the input value wasn't found in the file, you can return a specific value, return null, or return the original input value
Default value When return a specific value is selected for the When no match is found parameter, and the input value wasn't found in the text file, this static value will be returned by the transform

Input Type

The transform supports string, integer, and binary values. Binary values need to be represented in the XML file in base-64 encoded format.

Multiple input values

The transform accepts multiple input values, and processes each of them individually

Return Type

The transform returns a string value for each input value

Usage

Sample XML file

<?xml version="1.0" encoding="utf-8" ?>
<department-replacements>
  <department-replacement incoming-value="2000" replacement-value="40043125"/>
  <department-replacement incoming-value="9100" replacement-value="40043126"/>
  <department-replacement incoming-value="9200" replacement-value="40043127"/>
  <department-replacement incoming-value="9201" replacement-value="40043128"/>
  <department-replacement incoming-value="9300" replacement-value="40043129"/>
</department-replacements>

Xpath Expression

string(department-replacements/department-replacement['{attributeValue}' = @incoming-value]/@replacement-value)

Output results

Input value Output value
9100 40043126
9201 40043128
9300 40043129

Last edited Feb 22, 2015 at 3:47 AM by ryannewington, version 1