Subject: Re: If/then/else confusion
From: Liam R E Quin <liam@xxxxxx>
Date: Tue, 25 Dec 2012 15:43:45 -0500
|
On Tue, 2012-12-25 at 13:14 -0700, Mark Wilson wrote:
> Thanks for the info Syd.
>
> I am using XSLT2, which I should have said in the original posting.
Mark, the difference between
if (Prefix != 'A') then 1 else 2
and
if (Prefix = 'A') then 2 else 1
is the case where there's no prefix element, as in the last case in your
set of examples.
$A != $B, for two nodelists, means,
there's some pair of elements a and b for which the value
of a is not equal to the value of b
So if $A is empty, there is no such value, and it's false.
$A = $B means there's some pair of values a and b whose values are equal
one with another. So if $A is empty, $A = $B is false.
not($A != $B) is true when $A is the empty sequence.
$A = $B is false when $A is the empty sequence.
Decide which you want and code accordingly :-)
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
|