[xsl] If/then/else confusion

Subject: [xsl] If/then/else confusion
From: Mark Wilson <mark@xxxxxxxxxxxx>
Date: Tue, 25 Dec 2012 12:19:03 -0700
Hello,
I am trying to modify a sort-select statement I worked out a very long time ago. In the original, I wanted not to sort by a <Prefix> if it were an 'A' and this code does just that:


<xsl:sort select="if( Prefix!='A' ) then Prefix else ''"/>

I am not sure why its positive version does not work:
<xsl:sort select="if( Prefix='A' ) then '' else Prefix"/>

However, my new task is to not sort by (1) <Prefix> if the prefix is 'A' or, (2) if the <CatalogName> contains 'SG'.

In the positive the statement look is:

<xsl:sort select="if( Prefix='A' or contains(CatalogName, 'SG')) then '' else Prefix"/>

That statement somehow works for the second filter, [the contains], but not the first [the prefix='A'].

I have no idea what is going on and would appreciate any help I can get.
Thanks,
Merry Christmas,
Mark

Current Thread