<xmod:IfNotEmpty>
<xmod:IfNotEmpty> renders the content between its opening and closing tags only when Value is not empty — i.e. has at least one character that isn't part of an empty string "" or null. Use it to show data only when it's available.
For if/else patterns, place an <xmod:IfEmpty> and an <xmod:IfNotEmpty> back to back with the same Value.
Example
Render an <img> only when imageUrl has a value:
<xmod:Template Id="Employees">
<DetailTemplate>
<h3>[[FirstName]] [[LastName]]</h3>
<xmod:IfNotEmpty Value="[[imageUrl]]">
<img src="[[imageUrl]]" alt="[[FirstName]] [[LastName]]" />
</xmod:IfNotEmpty>
<xmod:IfEmpty Value="[[imageUrl]]">
<img src="/images/NoImage.png" alt="No photo on file" />
</xmod:IfEmpty>
</DetailTemplate>
</xmod:Template>Properties
| Property | Values | Default | Description |
|---|---|---|---|
| Value | string | token | The value tested for non-emptiness |
Property Details
Value: The value to test. Most commonly a
[[FieldName]]token bound to a database column. The content renders only when the resolved value is not an empty string and notnull. Whitespace-only values (e.g." ") count as non-empty.When the attribute uses a field token, single-quote the value:
Value='[[FieldName]]'—[[FieldName]]contains brackets that conflict with double quotes inside the XML attribute parser.