xsl:if
Executes its body only if the test expression evaluates to true.
<xsl:if test="@status = 'active'">
...
</xsl:if>xsl:if is a one-armed conditional — there is no else branch. The test attribute is evaluated as an XPath boolean using the standard effective boolean value rules: a non-empty node sequence is true, a zero number is false, an empty string is false, and so on. For multi-way conditionals use xsl:choose.
Attributes
| Attribute | Description |
|---|---|
test |
XPath expression evaluated as a boolean. Required. |
Example
<xsl:if test="count(item) > 10">
<warning>more than ten items</warning>
</xsl:if>