Convert string to lowercase-uppercase in xslt

By
Advertisement


Introduction:
In my previous article I have explained about  How to maintain scroll position on postback. In this article I am going to explain about how to convert the text to uppercase and lowercase in xslt.

Explanation:
Declare the three xslt variables one for lowercase characters and one for uppercase characters. And the third one is to assign the input value. Below is the sample code.

<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:variable name="toconvert">SamPLE TeXt</xsl:variable>


Now to convert the “SamPLE TeXt” to lowercase below code is used

<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>

To convert the “SamPLE TeXt” to uppercase below code is used

<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>

Do you like this article? Help us to improve. Please post your comments below.

0 comments:

Post a Comment

Online Casino