If then Xslt Choose

If there is image/filename then use the first filename found, otherwise show image not found.

<xsl:choose>
    <xsl:when test="image/filename">
        <IMG>
            <xsl:attribute name="src">
                <xsl:value-of select="image/filename[1]" />
            </xsl:attribute>
        </IMG>
    </xsl:when>
    <xsl:otherwise>
        <IMG>
            <xsl:attribute name="src">
                <xsl:text>http://images.domain.com/NAN.gif</xsl:text>
            </xsl:attribute>
        </IMG>
    </xsl:otherwise>
</xsl:choose>
Comments are closed.