Mappings provide a simple way of mapping one value into another by specifying a mapping in the rewriter configuration.

Arguments

from
The value being mapped from.
to
The value to be mapped to.

Remarks

Static mapping transforms are good for small lists of values that you want to replace. For more complex mappings, it would be more efficient to create a custom transform.

Examples

Defining a static mapping:

To define a mapping of recognised areas, you might set up a mapping as follows:

<mapping name="areas">
<map from="sydney" to="1" />
<map from="melbourne" to="2" />
<map from="brisbane" to="3" />
</mapping>

Using a static mapping:

Below, the areas mapping is used to map the value in $1. If the value is not found in the map, then “0″ is used as the default.

${areas:$1|0}

Below, the areas mapping is used to map the value in $3. If the value is not found in the map, then the expression is replaced with an empty string.

${areas:$3}

See Also