2

I have the below match condition which used to do a job of getting the results in case the value was present in the appName that I sent:

  <xsl:if test="contains($appName , $value)">
                        <xsl:call-template name="formResponseBody">
                        </xsl:call-template>
  </xsl:if>

Now however, I have to do the exact same test but ignoring the case of the data in "$value".

I have tried using translate functions but they either convert to upper or lower, but my test case is the data is a value can be "TEST","test","TesT".

<xsl:variable name="lowercase">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="uppercase">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="value1" select="translate($value, $uppercase, $lowercase)"> 

Is this possible in XSLT 1.0 ?

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
swetad90
  • 784
  • 1
  • 13
  • 34

1 Answers1

1

Normalize both the $appName and $value to either upper-case or lower-case, and then test whether the normalized $appName contains the normalized $value:

<xsl:if test="contains(
                translate($appName, $uppercase, $lowercase) , 
                translate($value, $uppercase, $lowercase))">
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147