|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Capitalizing content of a variable
"Nitin Dutt Mathur" <nitin@xxxxxxxxxxxx> wrote:
[snip]
> <component ..>
> <xsl:variable name="foo">
> <!-- do dome processing to get the value of variable-->
> </xsl:variable>
> <!-- At this point I want to have the capitalize value of the contents of
> foo variable (may be in same variable or in some other variable. -->
> </component>
>
> Since at the time of transforming the contents of variable I don't know the
> exact contents hence I unable to figure out how to use translate function.
>
You have to split the string using substring(), translate the substring
containing the first character, and concat the results.
Try
<xsl:variable name="bar"
select="concat(translate(substring($foo,1,1),'abc...','ABC...'),
substring($foo,2))"/>
In order to keep it more readable, often variables are declared
and used for the constant strings:
<xsl:variable name="lower" select="'abc...'"/>
<xsl:variable name="upper" select="'ABC...'"/>
...
translate(...,$lower,$upper)
...
You may also include non-ASCII characters in the translation string, if
necessary. The following can be used to upcase german umlauts:
<xsl:variable name="lower" select="'äöü'"/>
<xsl:variable name="upper" select="'ÄÖÜ'"/>
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








