Sunday, October 19, 2014

Handle case insensitive in XSLT


We may be looking for functions like ToUpper or ToLower but Translate is the function given in  XSLT.

<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name ="Rows" select="/dsQueryResponse/Rows/Row[contains(translate(@UserName,$uppercase,$lowercase),'smith')]" /> 

Do not forget to include single quotes for lowercase/uppercase variables.


No comments:

Post a Comment