I have a co-worker who writes news releases that are titled ENTIRELY IN CAPS. While this may be effective in email communication, or even a standard when making a news release. The look and feel of it can reduce its value to the point of not even wanting to see it.
The problem I ran into is that I needed to convert this to lowercase and then Capitalize the first character of every word. To do this, simply create an XSL file with the following code:
<xsl:variable name=”lowercase”>
abcdefghijklmnopqrstuvwxyz
</xsl:variable>
<xsl:variable name=”uppercase”>
ABCDEFGHIJKLMNOPQRSTUVWXYZ
</xsl:variable>
<xsl:variable name=”toconvert”>
ALL THIS TEXT IS WRITTEN IN CAPS AND IS DRIVING ME CRAZY
</xsl:variable>
<xsl:variable name=”newtext”>
<xsl:value-of select=”translate($toconvert,$uppercase,$lowercase)”/>
</xsl:variable>
This code will put the new text into a variable called newtext, which could then be displayed. To capitalize the first letter of every word, simply style it with CSS using text-transform:capitalize;
You can also convert everything from lowercase to uppercase by simply switching the last line of text with this one.
<xsl:variable name=”newtext”>
<xsl:value-of select=”translate($toconvert,$lowercase,$uppercase)”/>
</xsl:variable>
I hope you find this useful! Also, if anyone has figured out how to turn a certain word to uppercase, let me know. For example, convert an acronym like “fbi” into “FBI”. This acronym is in a sentence, so the code above wouldn’t work!








How would this work for multiple xsl fields? I don’t want to apply it to my entire style sheet.
Thanks.