Hi Mukul,
I got expected. Thanks a lot for your detailed explanation.
Regards,
Ramkumar,
R&D - Software Engineer
PreMedia Global Ltd
-----Original Message-----
From: Mukul Gandhi [mailto:gandhi(_dot_)mukul(_at_)gmail(_dot_)com]
Sent: Wednesday, October 07, 2009 2:33 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] String Case Conversion: Title Case
you might use a custom XSLT (2.0) function like below:
<xsl:function name="my:titleCase" as="xs:string">
<xsl:param name="str" as="xs:string" />
<xsl:sequence select="string-join(for $x in tokenize($str,'\s') return
concat(upper-case(substring($x, 1, 1)), lower-case(substring($x, 2))), ' ')"
/> </xsl:function>
and call it like:
<xsl:value-of select="my:titleCase($str)" />
please make sure, that a namespace is declared as well (e.g,
xmlns:my="http://www.example.com/myfuncs").
For e.g, this function when called with argument, heLLO worLD produces
output:
Hello World
You could also think, about cultural issues as pointed by Mike. But I think,
the above example could be a simple algorithm for transforming English
phrases, where you just want to capitalize the first letter of the word, and
keep rest of letters in the word as small case.
On Wed, Oct 7, 2009 at 12:34 PM, Ramkumar
<ramkumar(_at_)premediaglobal(_dot_)com>
wrote:
Hi List,
I have used upper-case and lower-case methods in xslt2.0. But I like
to know, how to convert Title-Case/Upper-Lower Case. Could any one
share with me the logic for this.
Ex:
Upper Case: UPPER CASE
Lower Case: lower case
Title Case: Title Case
Regards,
Ramkumar
R&D - Software Engineer
PreMedia Global Ltd
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--