xsl:if

Conditionally instantiates the contained template body.

Format

<xsl:if test = "expression">
               

              
template_body
                   

                
</xsl:if>

Description

The XSLT processor evaluates the expression and converts the result to a Boolean value. If the result is true, the XSLT processor instantiates template_body. If the result is false, the xsl:if element has no effect.

Example

This following example formats a group of names as a comma-separated list:

<xsl:template match="namelist/name">
               

              
<xsl:value-of select="." />
                   
<xsl:if test="not(position()=last())">, </xsl:if>
                   

                
</xsl:template>

If you want the XSLT processor to choose which template to instantiate from several possibilities, specify the xsl:choose instruction. See xsl:choose.

Convert DTD to XML

Learn how to create a sample XML instance document from a DTD using Stylus Studio DTD to XML conversion tools.

XML Editing Views

Stylus Studio includes three synchronized XML editing views: Text View, Tree View, and Grid View, allowing you to work with and edit XML documents in whatever way suits you best.

Metals, Mining & Crude-Oil Production

It can be very dark and dreary in a mine. That's why metal, mining & crude-oil production are using Stylus Studio as their light when it comes to data integration. See which of these top companies are using Stylus Studio to show them the way to XML!

HTML to XML Importer

Convert HTML to XML with the Stylus Studio HTML to XML Importer, a powerful, visual utility for Converting HTML to XML with ease.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member