XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Graham O'SheaSubject: Alternative Image.
Author: Graham O'Shea
Date: 21 Apr 2005 05:35 PM
I am a complete newbie to XSLT, I have been managing quite well with the help of Stylusstudio and the tutorial videos. I am stuck on 1 thing and hopefully somebody can help me out.

I have an image element in my XML this is sometimes returned empty. How do I show an alternative image if the element is returned empty?

Be gentle with the answers, as I say I a complete newbie.

Posttop
(Deleted User) Subject: Alternative Image.
Author: (Deleted User)
Date: 22 Apr 2005 03:50 AM
Hi Graham,
supposing that the image is stored in an attribute named "image", a possibile solution is this one

<img>
<xsl:attribute name="src">
<xsl:if test="@image"><xsl:value-of select="@image"/></xsl:if>
<xsl:if test="not(@image)">placeholder.gif</xsl:if>
</xsl:attribute>
</img>

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

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