This function searches for elements/attributes by the specified Location Path interpreted against the specified context element. As soon as any element/attribute with a non-null value is found, that value is returned as the function result.

If no data items can be found by the specified location path, the function returns null.

Effectively, this function returns the same result as one of the following calls (however, it will work faster):


getValuesByLPath(element, lpath).elementAt(0)
or
getValuesByLPath(lpath).elementAt(0)

Note: In general, the processing of Location Paths takes some resources, so if a data item you are seeking is located somewhere near to the context element, you may consider finding it in a different way. For example, the expression:


findChild("SourcePosition").getAttrValue("fileDir")
may work substantially faster than the call:
getValueByLPath("SourcePosition/@fileDir")
however, both will return the same result.

Parameters:

element

The context element against which the Location Path is interpreted.

If this parameter is not specified, the Location Path will be interpreted against the generator context element, which is the same as the call: contextElement.getValueByLPath(lpath)

See Also: GOMContext.contextElement

lpath
The Location Path expression specifying how the elements or attributes should be searched.

Use the Location Path Builder (found at the left panel's tree) to quickly construct a Location Path needed for this parameter.

See Also:

getValuesByLPath(), hasValuesByLPath(), findChild(), getAttrValue(), GOMElement.value

${include ../../../refs/lpaths.htm}