xsl:if Element

Allows simple conditional template fragments.

<xsl:if
  test = boolean expression>
</xsl:if>

Attributes

  • test
    Required. The condition in the source data to test. If the expression in this attribute evaluates to true when cast to a Boolean, the contents of <xsl:if> are placed in the output. Node-sets are cast to a Boolean True if they contain at least one node.

Element Information

Number of occurrences Unlimited
Parent elements xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements
Child elements xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, output elements

Remarks

The content is a template. The expression is evaluated, and the resulting object is converted to a Boolean. If the result is True, the content template is instantiated; otherwise, nothing is created.

See Also

XSLT Elements | Conditional Templates

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.