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.
<window>
<attribute name="title" if="${new}">Untitled</attribute>
<attribute name="title" unless="${new}">${title}</attribute>
</window>
In addition, you can specify a XML fragment as the value of the attribute. The XML fragment is so-called the native content.
<html>
<attribute name="content">
<ol>
<li forEach="${values}">${each}</li>
</ol>
</attribute>
</html>
where ol and li are part of the native content. They are not ZK components. They will be eventually converted to a String instance and assigned to the specified attribute. If values has three elements, the above example is equivalent to the following:
<html>
<attribute name="content"><![CDATA[
<ol>
<li>${values[0]}</li>
<li>${values[1]}</li>
<li>${values[2]}</li>
</ol>
]]></attribute>
</html>
|
Attribute Name |
Description |
|---|---|
|
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: none] Specifies the condition to evaluate this element. |
|
unless |
[Optional][Default: none] Specifies the condition not to evaluate this element. |