Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that we are at the current node:
<xsl:value-of select="translate(substring(., 1,1), 'qwertyuiopasdfghjklzxcvbnm',
'QWERTYUIOPASDFGHJKLZXCVBNM')"/>
<xsl:value-of select="substring(., 2)"/>
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic