Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

James Robertson http://www.r0bertson.co.uk

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Using XSLT to convert a value to upper or lowercase

This code was copied from XSLT Case Conversion Solution [topxml.com]

Firstly lets place all the letters of the alphabet, lower case and upper case in variables.
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>

To then convert our data to upper case we use the translate method, which replaces all the lower case characters with upper case.
<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>

Lower Case Transformation

The lower case transformation is basically the same:
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS