Testing conditions with xsl:if

  <xsl:template match="composition">
    <h3><xsl:value-of select="title"/></h3>

    <ul>
     <xsl:if test="string(date)">
       <li><xsl:value-of select="date"/></li>
     </xsl:if>
     <xsl:if test="string(length)">
       <li><xsl:value-of select="length"/></li>
     </xsl:if>
     <xsl:if test="string(instruments)">
       <li><xsl:value-of select="instruments"/></li>
     </xsl:if>
     <xsl:if test="string(publisher)">
       <li><xsl:value-of select="publisher"/></li>
     </xsl:if>    
    </ul>

    <p><xsl:apply-templates select="description"/></p>    
    
  </xsl:template>

View Transformed Document in Netscape
Previous | Next | Top | Cafe con Leche

Copyright 1999-2001 Elliotte Rusty Harold
Elliotte Rusty Harold
Last Modified September 23, 1999