Associates a service attribute with the specified name and value to the specified element. (See also "What are Service Attributes?" below.)
If the element already has a service attribute with that name, its value is replaced with the new one.
Parameters:
element
The element whose service attribute is to be set. If not specified, the
generator context element is assumed by default, which is the same as the call:
setServiceAttr(contextElement, attrName)
attrName
The name of the service attribute to be set.
value
The value to be assigned to the service attribute.
It may be any object including null
.
Returns:
The previous value of that service attribute ornull
, if no service attribute with the specified name has been attached to the specified element.Note:
null
can be also a legitimate value of a service attribute. To distinguish if the attribute had anull
value or did not exist, usehasServiceAttr()
function.
See Also:
getServiceAttr(), hasServiceAttr(), removeServiceAttr()
${include ../../../refs/service_attrs.htm}