This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Conditional expressions using optional attributes/elements
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] Conditional expressions using optional attributes/elements
- From: "Aleksei Valikov" <valikov at fzi dot de>
- Date: Mon, 13 Aug 2001 15:47:36 +0200
- References: <F991D4265D6AD4119A1900508BC98E57CF77BA@NTEXCL01>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi.
> Problem 1:
> <xsl:if test="@enabled != 'false' and @override != 'false'">
> <!-- do something -->
> </xsl:if>
> But if the attributes are not defined, it doesn't act as expected.
Try not(@enabled='false') and not(@override='false')
See the definitions of equality expressions with node-sets. You'll
understand why a != b is not the same as
not(a=b)
> I have an element which has optional *elements*, and I want to test the
> values of attributes of these elements. Here's the DTD:
> <xsl:if test="enabled/@value != 'false' and override/@value != 'false'">
> <!-- do something -->
> </xsl:if>
> But if the *elements* are not defined, it doesn't act as expected.
The same - use not(enabled/@value = 'false').
Bye.
/lexi
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list