-2

I am trying try this link for else if condition but without sucess.

My code is

<xsl:choose>
  <xsl:when test="//./ActionParams/@txt_sid = '110'">
    <xsl:for-each select="ext">
      <config type="2" 
              localserver="newxyz.com" 
              liveserver="newxyz.com" 
              httpuri="/etmailregistration/ok/UnsubFrmApp?sendmail=1" 
              params="txt_id,txt_sid" 
              readtimeout="39000" retry="3"/>
    </xsl:for-each>
  </xsl:when>
  <xsl:otherwise>
    <xsl:for-each select="ext">
      <config type="2" 
              localserver="oldxyz.com" 
              liveserver="oldxyz.com" 
              httpuri="/etmailregistration/UnsubFrmApp.aspx?sendmail=1" 
              params="txt_id,txt_sid" 
              readtimeout="39000" 
              retry="3"/>
    </xsl:for-each>
  </xsl:otherwise>
</xsl:choose>

My service call is only newxyz.com

If txt_sid = 110 then it calls newxyz.com
If txt_sid = 120 then it calls newxyz.com, not oldxyz.com

Can you please tell me where I am wrong.

Community
  • 1
  • 1
Rohit Azad Malik
  • 31,410
  • 17
  • 69
  • 97

1 Answers1

2

Your test says “if anywhere in the document, there is an ActionParams element that is not the top-most element and that has an attribute txt_sid with a value of '110', …”.

Now, you didn't provide enough input to be sure and you didn't specify what you expected to happen and what you saw instead. But I'm feeling like guessing today and will assume that you didn't want to always check the full document, but only below your current context. Try either using ./ActionParams/@txt_sid='110' or .//ActionParams/@txt_sid='110', depending on what exactly you are looking for. It's probably a good idea to first think about what you are looking for instead of blindly trying one of these.

Christopher Creutzig
  • 8,656
  • 35
  • 45