Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • trfletch 598 posts 604 karma points
    Feb 24, 2009 @ 18:59
    trfletch
    0

    Show labels depending on whether there are relevant articles

    Hi,

    I actually have three questions for this one. I currently have the following XSLT code but it is not working correct, maybe I have done something really stupid but it seems to be displaying the opposite of what I want, for the first section I want it to display all news items that have an article type of "Editorials" but it is displaying all articles except ones that have an article type of "Editorials", the same is happening for the "Columists" part. Hopefully someone can spot what mistake I have made straight away and can answer my other question.

    I want it to only display the "h1" text if it does find news items with that articletype (i.e. if there are no news articles with the article type of "Editorials" then I don't want the "h1" Editorials tag displayed). How would I go about changing the code to do that?

    The last question is whether this is the most efficient way to do this bearing in mind I have 12 different "Article Types" so I will have to repeat the code 12 times. Thank you for any help, the code I have so far is as follows:

    Editorials




    Columnists



  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 24, 2009 @ 20:34
    Dirk De Grave
    0

    Hi,

    Change

    [code]

    Editorials



    [/code]

    Regards,
    /Dirk

  • trfletch 598 posts 604 karma points
    Feb 25, 2009 @ 15:57
    trfletch
    0

    Excellent, thank you for the response that has resolved my issue, I take it the "!" makes a command do the opposite then.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 25, 2009 @ 16:23
    Dirk De Grave
    0

    Hi,

    Yep, != means 'is not equal to' in xslt slang.

    Regards,
    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft