The attribute Element

<attribute name="myName" [trim="true|false"]>myValue</attribute>

It defines a XML attribute of the enclosing element. The content of the element is the attribute value, while the name attribute specifies the attribute name. It is useful if the value of an attribute is sophisticated, or the attribute is conditional.

<button label="Hi">
<attribute name="onClick">alert("Hi")</attribute>
</button>

It is equivalent to

<button label="Hi" onClick="alert(&quot;Hi&quot;)"/>

Another example:

<button>
<attribute name="label" if="${param.happy}">Hello World!</attribute>
</button>

name

[Required]

Specifies the attribute name.

trim

[Optional][Default: false]

Specifies whether to omit the leading and trailing whitespaces of the attribute value.

if

[Optional][Default: true]

Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false.

unless

[Optional][Default: false]

Specifies the condition not to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true.