dvm:lookupValue

Syntax

dvm:lookupValue(mapName, referenceElementName, referenceValue, elementName, defaultValue, needAnException)

Description

The dvm:lookupValue function finds the reference element value in a domain value map and returns the equivalent value of the specified element name as a string. This form of DVM lookup is used to find a single reference element and return a single element value. Lookups involving multiple elements in a reference or return domain need to be done using the dvm:lookupValueNVP function.

Parameters

Parameter Description

mapName

The domain value map name, as string.

referenceElementName

The source element name, as string.

referenceValue

The source value (an XPath expression bound to the source document of the XSLT transformation), as string.

elementName

The target element name, as string.

defaultValue

If the value is not found, then the default value is returned, as string.

needAnException

Specify true or false.

If the needAnException parameter is set to true, an exception occurs if the value being looked up in the map is not found. If the needAnException parameter is set to false, an empty value is returned if the value being looked up in the map is not found.

Returns

The dvm:lookupValue returns a string containing the value of the element.

An exception can occur for the following reasons:

  • The DVM map with the given name is not found.

  • The specified elements are not found.

  • The specified source value is empty.

Example

The following code looks up the value of the Short element in the StateCodes DVM map corresponding to the California value in the Long element:

dvm:lookupValue("StateCodes","Long","California","Short","CouldNotBeFound",True)