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.

The Java Architecture for XML Binding (JAXB)

In this JAXB tutorial, we'll show you how easy it is to generate JAXB bindings!

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.

Industrial & Farm Equipment

Industrial & farm equipment manufacturers are mowing away the time it takes for data integration with the power of Stylus Studio 2006! See which top industrial and farm equipment manufacturers are cowboying up with Stylus Studio.

Binary XML

How do I get my binary data into XML? How do I get my binary data out of XML? The answers to these questions and more in this amazing Binary XML tutorial.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member