Re: [xsl] replace -x to -X

Subject: Re: [xsl] replace -x to -X
From: Renate <renaate@xxxxxxxxx>
Date: Mon, 10 Jul 2006 19:27:51 +0300
How can I do this with translate and substring?

--- XSL beginner

On 7/10/06, andrew welch <andrew.j.welch@xxxxxxxxx> wrote:
On 7/10/06, Renate <renaate@xxxxxxxxx> wrote:
> I have a string $tmp_string.
>
> for ex., JIMMY-DIMMy
>
> And I need to change the following:
> first letter is in uppercase
> other letters are in lowercase
> first letters after "-" sign also is in uppercase
>
> the result will be:
> Jimmy-Dimmy
>
>
> I know how to make Jimmy-dimmy, but how to make Jimmy-Dimmy...???

If you are transforming to HTML then you might want to use CSS:

text-transform: capitalize

This will do what you're after.  If you want to do it in XSLT then I
you'll have to use a recursive solution in 1.0 or tokenize in 2.0 (or
1.0 + extensions) with translate and substring.

cheers
andrew

Current Thread