xsl:if

<xsl:if>
Syntax:
<xsl:if test=”expression” > </xsl:if>
The xsl:if element evaluates an expression which returns a Boolean result to determine if a template should be instantiated. The evaluation is a simple True or False test on a defined condition or a set of conditions. If the test returns True, the template is applied and the results are displayed in the output. If False, the template is not applied (i.e., the contents between the opening and closing xsl:if are skipped over).
The actions of the xsl:if element are analogous to the if statement found in many other computer languages, such as in C and VBScript. However, there is no else statement. Therefore, if you need to choose from two or more possible courses of action, you may prefer to use the xsl:choose element.
One possible use of this element is to test for errors. The xsl:message element can be used to display error messages.
This is not a self-closing element. The separate closing element is mandatory.
test=”expression”
The mandatory test attribute is set to an expression that is a conditional test with either a True or Falseanswer. The expression can contain more than one test condition by using the and, not, and or operators.
Scroll to Top