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.

WYSIWYG XSLT Designer

Stylus Studio's powerful and easy-to-use WYSIWYG ("What you see is what you get") XSLT Designer lets you create XSLT stylesheets without writing any code! Go from a blank slate to solid, robust XSLT in minutes, using simple drag-and-drop operations.

Translating EDIFACT Documents to XML

The EDIFACT to XML Converter is a primary component of the adapter library. The XML that is generated is well commented and indented, and can be used anywhere XML is normally used — with XML Schemas, XQuery, XSLT, and so on.

Advertise with Stylus Studio

Need to get your products and/or services in front of millions of qualified enterprise XML developers? Partner with Stylus Studio, the world's largest XML developer community!

XQuery Debugger

The Stylus Studio XQuery Debugger allows you to set breakpoints and step through the evaluation of any XQuery expression in a way that gives you complete control and visibility into the XQuery expression evaluation process.

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.