aspose file tools*
The moose likes XML and Related Technologies and the fly likes Converting lower case chars to upper case (or vice versa) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Converting lower case chars to upper case (or vice versa)" Watch "Converting lower case chars to upper case (or vice versa)" New topic
Author

Converting lower case chars to upper case (or vice versa)

John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
In an input document there are strings (for lack of a better term) that are all lower case(foo, true, etc.). In the output document they need to have the first char capitalized(Foo or True). So I need to convert the first char from a lower case to upper case.
I have been going through my XSLT book and haven't found a direct way to do this. I was thinking that I could write an extension using the Java String class to do the trick.
Any other solutions to this?
Thanks,
John


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
XSP and tag libs can help you do it. I know many purists will not consider a clean design( using JSP with transformations. )
Checkout jakarta.apache.org for projects such as XTags.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Oops, sorry. I wasn't too clear on that original post.
The input is an XML doc and I'm using an XSL stylesheet to do some transformations. No JSPs in sight since this is a back-end app.
John
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Assuming that we are at the current node:
<xsl:value-of select="translate(substring(., 1,1), 'qwertyuiopasdfghjklzxcvbnm',
'QWERTYUIOPASDFGHJKLZXCVBNM')"/>
<xsl:value-of select="substring(., 2)"/>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting lower case chars to upper case (or vice versa)