[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Error trapping in xsl

Subject: RE: Error trapping in xsl
From: "Tim Watts" <timw@xxxxxxx>
Date: Fri, 13 Jul 2001 09:54:05 +1000
xsl show images
Hi Oliver,

Does that stylesheet work?

I would have thought the <xsl:when test="image_link"><!--ELEMENT CONTENT NOT
EMPTY--> test would just show if the element exists or not - regardless of
if it has a value at all.

That would mean, as the <image_link> would be a child of each apply-template
rule you use (presumably) that you would still be getting the broken images.

However, a <xsl:when test="image_link != ''"><!--ELEMENT CONTENT NOT
EMPTY--> should work correctly, and the empty nodes show the null.gif

Regards,

Tim


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of dante
Sent: Thursday, 12 July 2001 5:53 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Error trapping in xsl


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@xxxxxxxxxxxxx
            www.vianet.net.au/~dante



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.