Social Networking Lot Tip Php Mysql Search Engine Optimization Insanity tricks Lotus Free blog Adminemail Divs Hourly Rates Strategy Import Video And Multimedia Section 508 Export Transitional Dtd Traveling Echo Intranet Information Systems Php File Images Links box model develop database Mysql Num Rows Search Google Software Applications Multimedia Products Membership Database Dynamic Css Nuances 26b Select Name Full Time Accurate Time Headaches redirect Military Installation Web App Microsoft encryption AJAX Variation Login Php Double Benefit mySQL Phpmyadmin Blackberry View Source Internet Explorer SEO WordPress Lt PHP Tips tips Password Reset Forefront Design developer Telegraph Email Account Dashboard 2.1 Strange Person Php Echo Colors Federal Employees Css Files Categories Color Scheme Marketing Web Design Lotus Notes Services Software steps Web Development Mobile Platforms Branding SQL Membership Login css Stylesheet News Releases Google Database Functionality Web Developers Csv Page Rank University Web Templates Free Download Habit Ektron Gsa Gov Hourly Fee Working With Clients Football Game Rant organization Last Straw Web Developer Transition PHP Formatting Address Book Firefox Mumbo Jumbo Html Xmlns Div Sql Server Tag Integrity Color Schemes XML Email Settings Laserjet 4100 Internet Explorer 7 Html Tag Term Relationships Server Username Ideas Time Frame Variables rss Capital Letters Server Hostname Reference Honesty Bandwidth Usage Gsa Mysql Fetch Array CMS Borders Information Technology Products Addressbook Css File System Administrator Array Php Variables Php Database Cms Content Transparent Image Work Log Area 51 Import Functionality New Features Asynchronous Javascript And Xml Longest Time Page Password Time Web Cat Id Content Management System Husker Football includes Telecommunications Products tools free templates Php Password Database Import W3c Gods Gift Index App Div Id 2.6. 2.62 Development Nate Screen Resolutions Br Web Applications Indexing Services Web Deans List Sql Database Joomla Download Doctype Portable Computers World Wide Web Config Php Fellow Web Seo Search Engine Optimization
Social Networking Lot Tip Php Mysql Search Engine Optimization Insanity tricks Lotus Free blog Adminemail Divs Hourly Rates Strategy Import Video And Multimedia Section 508 Export Transitional Dtd Traveling Echo Intranet Information Systems Php File Images Links box model develop database Mysql Num Rows Search Google Software Applications Multimedia Products Membership Database Dynamic Css Nuances 26b Select Name Full Time Accurate Time Headaches redirect Military Installation Web App Microsoft encryption AJAX Variation Login Php Double Benefit mySQL Phpmyadmin Blackberry View Source Internet Explorer SEO WordPress Lt PHP Tips tips Password Reset Forefront Design developer Telegraph Email Account Dashboard 2.1 Strange Person Php Echo Colors Federal Employees Css Files Categories Color Scheme Marketing Web Design Lotus Notes Services Software steps Web Development Mobile Platforms Branding SQL Membership Login css Stylesheet News Releases Google Database Functionality Web Developers Csv Page Rank University Web Templates Free Download Habit Ektron Gsa Gov Hourly Fee Working With Clients Football Game Rant organization Last Straw Web Developer Transition PHP Formatting Address Book Firefox Mumbo Jumbo Html Xmlns Div Sql Server Tag Integrity Color Schemes XML Email Settings Laserjet 4100 Internet Explorer 7 Html Tag Term Relationships Server Username Ideas Time Frame Variables rss Capital Letters Server Hostname Reference Honesty Bandwidth Usage Gsa Mysql Fetch Array CMS Borders Information Technology Products Addressbook Css File System Administrator Array Php Variables Php Database Cms Content Transparent Image Work Log Area 51 Import Functionality New Features Asynchronous Javascript And Xml Longest Time Page Password Time Web Cat Id Content Management System Husker Football includes Telecommunications Products tools free templates Php Password Database Import W3c Gods Gift Index App Div Id 2.6. 2.62 Development Nate Screen Resolutions Br Web Applications Indexing Services Web Deans List Sql Database Joomla Download Doctype Portable Computers World Wide Web Config Php Fellow Web Seo Search Engine Optimization

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!

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

    Thanks.

    Brenda on December 16th, 2009 at 6:31 pm
Would you like to login?