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

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 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)"/>

uppercase-at function

    uppercase-at: func [
        "Changes the letters at the specified positions to uppercase"
        string positions [any-block!]
    ] [
        foreach pos positions [uppercase/part at string pos 1]
        head string
    ]
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS