[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

SV: Combining two test using the "and" operator


Subject: SV: Combining two test using the "and" operator
From: Tony Fabian <tof@xxxxxxxxxxxxx>
Date: Tue, 7 Dec 1999 15:45:45 +0100

Hi Mike

Thank you for your advice. I will remember that!
I am using cocoon for linux. 

I have a tag called <infoblock>. I can assign the imagehref
attribute (not required). In IE5 if there is not a imagehref att.
it does nothing. Cocoon on the other hand says "the imagehref attribute
is not equal to '' " so lets do the stuff. 

Therefore I have to check is there IS an attribute called imagehref and if
so 
what is the value. I thought i would give me a cleaner code to keep
it in one sentene instead of two.

<infoblock> some stuff</infoblock>

<xsl:if test =".[@imagehref != '']">
         IE5 does nothing
	   cocoon does something	
</xsl:if>

Kind regards

Tony

-----Oprindelig meddelelse-----
Fra: Kay Michael [mailto:Michael.Kay@xxxxxxx]
Sendt: 7. december 1999 12:42
Til: 'xsl-list@xxxxxxxxxxxxxxxx'
Emne: RE: Combining two test using the "and" operator


> <xsl:if test ="@imagehref">
> <xsl:if test =".[@imagehref != '']">

Your question leaves me slightly suspicious that you are using Microsoft XSL
rather than W3C XSLT, in which case ignore this answer. (It's always useful
on this list to say what product you are using).

If you want to test that the current node has an imagehref attribute and
that its value is not the empty string, two simple ways to do it are: 

<xsl:if test="string(@imagehref)">
<xsl:if test="@imagehref!=''">

You don't actually need to use the and operator.

Mike Kay



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



Current Thread
Keywords