Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 500
  • Last Modified:

xpath: how to capitalize the first word

Hi,

I have an xsl file for transforming xml data to html. Does anyone know how to make the first alpahabet in a String to Upper case? i.e

I want the button to show Albert instead of albert

thanks.

xml data
<stuff>
  <some>
     <name>albert</name>
  </some>
</stuff>

xsl code sniplet
<xsl:variable name="somename" select="/stuff/some/name" />
...
....
...

<input type="submit" name="Submit" value="{$somename}"/>

0
ahuen
Asked:
ahuen
  • 2
1 Solution
 
avnerCommented:
Use CSS for that :

<STYLE>
    BUTTON:first-letter {text-transform: uppercase ;font-weight:400; }
</STYLE>

<BUTTON>ahhhhhh !</BUTTON>
0
 
ahuenAuthor Commented:
avner,

Please provide more details.

Thanks.
0
 
avnerCommented:
Take this bit of code :

<STYLE>
   P:first-letter {text-transform: uppercase ;font-weight:400; }
</STYLE>

<P>ahhhhhh !</P>

Save it under a file named  : something.html

View this code in the browser you'll see that the first A is capitlzed.

The thing is Pseudo-classe "first letter" , it means give a specific STYLE to the first letter , in this letter I use :
text-transform: uppercase  , whihc means UPCASE this letter.

Hope it helps a little more.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now