We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Need help adding if / else statements in XSL markup

egoselfaxis
egoselfaxis asked
on
Medium Priority
316 Views
Last Modified: 2012-05-11
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
Comment
Watch Question

Information Architect
CERTIFIED EXPERT
Top Expert 2006
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
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')">

Author

Commented:
Thanks so much!  Your suggestion worked.

Cheers,
- Yvan
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
welcome
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.