We have moved!

You are currently looking at documentation for Umbraco 8 and older versions.
An automated guess is that docs.umbraco.com/umbraco-cms/reference/templating/macros/xslt/some-xslt-logic could be the link to the new documentation for Umbraco 9 and newer versions.

    Some XSLT Logic

    XSLT has some logic commands that are useful to processing criteria based output. These commands are the "if" and "choose" commands.

    The "if" command is useful for deciding to show content or not based on a single criteria. There is no "else" in XSLT, so, the if is somewhat limited.

    <xsl:if test="@nodeName = 'example' ">
        <!-- do this -->
    </xsl:if>
    

    The "choose" command is a bit more powerful in that it allows for multiple choices to be selected from.

    <xsl:choose>
        <xsl:when test="@nodeName = 'example' ">
            <!-- do this -->
        </xsl:when>
        <xsl:otherwise>
            <!-- do this -->
        </xsl:otherwise>
    </xsl:choose>
    

    In this example, you can have as many when statements as you like, but must have the otherwise statement.

    This was copied the original book from Casey Neehouse from the books section of umbraco.org