Saturday, May 12, 2012

convert uppercase to lowercase in xslt


Here i will show how to translate the uppercase letter to lowercase using xslt.For this i have created a variables ,which are used in this conversion process.Then the result will be assigned to one parameter which is "purl".
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="CurrentUrl"></xsl:param>
    <xsl:param name="PUrl"></xsl:param>
    <xsl:variable name="lowercletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
    <xsl:variable name="uppercletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable> 
    <xsl:template match="/">
        <xsl:for-each select="/Item/Menu">
            <xsl:if test="$PUrl = translate(Link, $uppercletters, $lowercletters)">
                <h1>
                    <xsl:value-of select="item"/>
                </h1>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
Post a Comment

Bel