Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    compare more than two strings

    Hi frinds

    I am trying to test condition somethiing like

    Code:
    <xsl:when test="contains(string,'stringA' || 'stringB'|| 'stringC')">
    <xsl:value-of select="'abcd" />
    But I am getting syntax error, can anyone help me how to test more than one string in one condition

    Thanks

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by javaguy1007 View Post
    Hi frinds

    I am trying to test condition somethiing like

    Code:
    <xsl:when test="contains(string,'stringA' || 'stringB'|| 'stringC')">
    <xsl:value-of select="'abcd" />
    But I am getting syntax error, can anyone help me how to test more than one string in one condition

    Thanks
    change arguments for containts:
    Code:
    <xsl:if test="containts('stringA || stringB || stringC','string')">
       ....
    </xsl:if>
    also both arguments must be string. Don't work with 'stringA' || 'stringB'|| 'stringC'
    you can use concat to join them:
    Code:
    <xsl:variable name="mystring" select(concat('stringA',' || ','stringB','|| ','stringC')"/>
    best ergards

    http://zvon.org/xxl/XSLTreference/Output/index.html

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •