Re: [xsl] If/then/else confusion

Subject: Re: [xsl] If/then/else confusion
From: Mark Wilson <mark@xxxxxxxxxxxx>
Date: Tue, 25 Dec 2012 20:20:21 -0700
I finally got it working with:
<xsl:sort select="if( Prefix!='A' and not(contains(CatalogName, 'SG'))) then Prefix else ''"/>


<Prefix> is ignored for all 'SG' catalogs and for Prefix = 'A' or no <Prefix> for the other catalogs.

Thanks again for your help on a holiday,
Best of the new Year,
Mark


On 12/25/2012 2:48 PM, Mark Wilson wrote:
Hello Liam, Ken, and Syd:

Thanks so much for your input - I was looking at the thing all wrong -- 20 years of C++ coding really prejudices one's view of if-then-else. Once explained, it makes perfect sense.

Thank you all for you help.

I don't celebrate Christmas, but do wish those of you who do a most merry holiday.

Regards,
Mark
On 12/25/2012 1:43 PM, Liam R E Quin wrote:
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





-- Mark Wilson Knihtisk Publishing

Current Thread