[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Capitalizing only the first letter of each word

Subject: Re: Capitalizing only the first letter of each word
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 21 Mar 2002 13:08:36 -0800 (PST)
xsl uppercase first letter
"Katie McNally" <kmcnally9 at hotmail dot com> wrote:

> I am getting back my data in ALL-CAPS.  Is there any way to display 
> the first letter of each word in uppercase, but the rest of each word

> in lowercase?
> 
> example XML:
> 
> <Tg Nm="Name">JOHN LEWIS</Fld>
> <Tg Nm="Street">8780 MAIN ST</Fld>
> <Tg Nm="City">COLORADO SPRINGS</Fld>
> <Tg Nm="State">CO</Fld>
> 
> I want to display:
> 
> John Lewis
> 8780 Main St
> Colorado Springs
> CO

Hi Katie,

You can use the str-split-to-words() function from the FXSL functional
programming library.

This will produce a list of words (you can specify any set of word
delimiters, which is appropriate).

Then for each word, just ***de-capitalise*** (convert to lower case)
the tail (substring($word, 2) ).

Converting to lower case can be accomplished using the translate()
function like this:

translate($someString, $upperCase, $lowerCase)

where the last two arguments should be defined as:

<xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowerCase" select="'abcdefghijklmnopqrstuvwxyz'"/>

Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.