Returns the first value component of the specified attribute contained in the specified element.

In the case of a single-value attribute, the function returns exactly that value.

When the attribute has a multiple (list) value (see GOMAttribute.multiValued), the function returns the first value component (list item).

The returned value is represented by an object corresponding to the attribute data type (see GOMAttribute.valueType).

Parameters:

element

The element whose attribute is requested. If not specified, the generator context element is assumed, i.e. the same as the call: getAttrValue(contextElement, attrName)
attrName
The attribute name.

Note: Some DSM Types may support pseudo- (or formula-) attributes. Such attributes are specified with the FlexQuery expressions which calculate the attributes' values from another (real) attributes, possible with the use of some functions.

Pseudo-attributes are treated the same way as the normal ones. (That's actually why the pseudo-attributes were introduced in the first place). Obtaining the value of a pseudo-attribute will just evoke the internal processing of its formula (therefore, if an error occurred during this, it will be reported accordingly). Externally, accessing pseudo-attributes looks the same as the accessing the normal ones. So does this function.

Returns:

The value of the found attribute. In the case, the attribute has multiple values, the function returns the first of them.

If the element contains no attribute with the specified name (or in the case element == null), the function returns null.

See Also:

getAttrValues(), getAttrFullValue(), hasAttrValue(), GOMAttribute.value, getValueByLPath()
Tips:

(1) You may call this function in a more method-like style:

element.getAttrValue(attrName)
(2) Using Location Path, the result returned by this function can also be obtained by the following call:
element.getValueByLPath("@attrName")
(however, it will work more slowly).