Saturday, June 16, 2012

Upper case to lower case and lower case to upper case in XSLT

Here i will show how to cover the lower case characters to upper case and upper case characters to lower case in xslt.There simple way i have used to create variable for both lower and upper letters ,then URL string replace will be done using those variable
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
    <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
    <xsl:template match="/">
        <xsl:variable name="PUrlLower" select="translate($PUrl, $ucletters, $lcletters)">
        </xsl:variable>
         <a>
           <xsl:attribute name="href">
                <xsl:value-of select="$PUrl"/>
            </xsl:attribute>
            <xsl:attribute name="title">
                <xsl:value-of select="$PTitle"/>
            </xsl:attribute>
            <xsl:value-of select="$PTitle"/>
        </a>
        </xsl:template>
</xsl:stylesheet>

No comments:

Bel