This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Error trapping in xsl
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Error trapping in xsl
- From: "dante" <dante at vianet dot net dot au>
- Date: Thu, 12 Jul 2001 15:52:55 +0800
- References: <3B4C9B9D.CD929586@dyomedea.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
G'Day all,
This is my first post to this list so any help would be appreciated.
I'm trying to error trap for empty elements in the xml document
using xsl:choose & I can't work out the syntax.
The element <image_link> contains the data for the image attribute src
& when it's empty a broken image is shown.
What I would like it to do is show a null image instead.
Here's what it looks like so far:
<xsl:choose>
<xsl:when test="foo"><!--ELEMENT CONTENT NOT EMPTY-->
<!--SHOW IMAGE LINK VALUE-->
<img><xsl:attribute name="src"><xsl:value-of
select="image_link" /></xsl:attribute></img>
</xsl:when>
<xsl:otherwise><!--ELEMENT CONTENT EMPTY-->
<!--SHOW NULL IMAGE-->
<img><xsl:attribute
name="src">null.gif</xsl:attribute></img>
</xsl:otherwise>
</xsl:choose
Is this the best/only method to use?
Is there a way of error trapping for empty elements globally using xsl?
I'm using the msxml3 parser to output the xml document to ie5.5.
Thanks,
Oliver Reid
dante@vianet.net.au
www.vianet.net.au/~dante
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list