Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using XSLT for initcaps?

Status
Not open for further replies.

jmreinwald

Technical User
Jun 3, 2002
46
US
Maybe a beginner question, but I can't seem to find anything on it after some quick searching. Here's a code snippet (with unnecessary stuff taken out):
Code:
<recordSet>
  <record>
    <so subtag="JN">
      <sf1>Journal of clinical oncology</sf1>
    </so>
...

As I'm parsing the xml with xslt, I'm already sitting at the <record> node, so I grab it with so/sf1.

The problem I'm running into is that I need the init caps. The only way I can think of is to grab the first character after a space and do a replace, but I don't want to initcap words like a, an, the, of, and so on.

There's probably a simply way to do it...
 
You'd have to store all the words you didn't want to capitalise in a variable, then replace all those instances in the string after you'd done the initial capitalisation.

Jon

"There are 10 types of people in the world... those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top