Copied to clipboard

Flag this post as spam?

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


  • Muhammad hussain 33 posts 53 karma points
    Jul 16, 2010 @ 09:56
    Muhammad hussain
    0

    Can we use Switch Statement in Xslt

    Hi All,

    I want to change my logic from if else in Xslt and want to use Switch Statement in Xslt.

    Can any one help me in this.

    Hussain

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jul 16, 2010 @ 10:03
    Kim Andersen
    2

    Hi there Muhammad

    Maybe you can use the choose-statement like this:

    <xsl:choose>
    <xsl:when test="1=2">
    Do stuff here
    </xsl:when>
    <xsl:when test="$name='Joe'">
    Do something else here
    </xsl:when>
    <xsl:otherwise>
    It none of the above when-statements are true, this will be shown
    </xsl:otherwise>
    </xsl:choose>

    Does that solve your problem?

    /Kim A

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 16, 2010 @ 10:13
    Ismail Mayat
    0

    Muhammed,

    You could create xslt extension method in c# and do switch statement there but its a bit overkill Kim's suggestion of xsl:choose is better.

    Regards

    Ismail

  • Muhammad hussain 33 posts 53 karma points
    Jul 16, 2010 @ 11:50
    Muhammad hussain
    0

    Hi Ismail,

    I want to do this thing in C# as u have mention above, Can u will guide me who Can i do this.

    Hussain

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 16, 2010 @ 12:01
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies