The attribute Element

The attribute element is a special element to define a XML attribute of the enclosing element. With proper use, it makes the page more readable. The following is equivalent to hello.zul described above.

<button label="Say Hello">
     <attribute name="onClick">alert("Hello World!");</attribute>    
</button>

You can control whether to omit the leading and trailing whitespaces of the attribute value by use of the trim attribute as follows. By default, no trim at all.

<button>
    <attribute name="label" trim="true">    
        The leading and trailing whitespaces will be omitted.        
    </attribute>    
</button>