Link to home
Start Free TrialLog in
Avatar of egoselfaxis
egoselfaxis

asked on

Need help adding if / else statements in XSL markup

I need to add some if / else statements to an XSL file.  


I understand that I can do something like this:

    <xsl:for-each select="CATALOG/CD">
            <xsl:if match=".[TOPIC='topic1']">
              <tr>
          <td><xsl:value-of select="TITLE"/></td>
          <td><xsl:value-of select="TOPIC"/></td>
        </tr>
        </xsl:if>
      </xsl:for-each>


However, .. how would I extend this to have mutiple conditionals, .. and with some "NOT EQUAL TO" operators?

if topic = "topic1" OR topic = "topic2" OR topic = "topic3"

if topic != "topic1" AND topic != "topic2" AND topic != "topic3"


Is this possible somehow?  If so, how?

Thanks!
- Yvan
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I messed up the quotes, inside the test attribute all should ne single quotes

in XSLT2 you can say

<xsl:if test="not(topic = ('topic1', 'topic2', 'topic3')">
Avatar of egoselfaxis
egoselfaxis

ASKER

Thanks so much!  Your suggestion worked.

Cheers,
- Yvan