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.

Berkeley DB XML and Stylus Studio

Develop XML applications for Berkeley DBXML with Stylus Studio integrated tools support for SleepyCat Software's DBXML. Open, Query and Save XML to and from Berkeley DB XML directly from within the Stylus Studio XML IDE.

XPath Query Editor

Stylus Studio's XML Editor has an XPath Query Editor that allows you to easily roubleshoot, test, and debug any XPath expression.

Transforming Non-XML Documents with XML Tools

This pages has audio from the Stylus Studio Presentation at Exchange 2005.

Building Web Services With Stylus Studio

This video demonstration shows you how to use Stylus Studio's Web Service call composer to locate a WSDL file on the Internet, inspect, create SOAP envelope, invoke and inspect Web service data.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member