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.

Stylus Studio API Documentation

Java API reference materials providing detailed information about Stylus Studio and other industry leading XML processing components.

Translating XML documents to EDIFACT

In-place, via XSLT and via XQuery are all mechanisms supported for converting XML to EDIFACT

EII - Enterprise Information Integration

Learn how to build EII applications with Stylus Studio's powerful Enterprise Information Integration Tools.

XQuery Profiler

Stylus Studio's XQuery Profiler allows you to benchmark any XQuery expression, and it helps you locate and eliminate performance bottlenecks for maximum XQuery performance.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member