This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: upper case
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] upper case
- From: Goetz Bock <bock at blacknet dot de>
- Date: Tue, 21 Aug 2001 15:32:02 +0200
- References: <14854.998398917@www9.gmx.net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
On Tue, Aug 21 '01 at 15:01, john wa wrote:
> <xsl:value-of
> select="translate($string,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRST
> UVWXYZ')"/>
>
> is this the only way to make a string upper case?
Yes, its the only way.
You might want to define a global variable for the uppercase and one for
the lowercase letters:
<xsl:variable name="uppercase">ABCDEFGHIJ...</xsl:variable>
<xsl:variable name="lowercase">abcdefghij...</xsl:variable>
than you can use
<xsl:value-of select="translsate($string, $lowercase, $uppercase)" />
when you maintain a one-to-one mapping between upper and lowercase you
can add as much additional characters as you like (e.g. ä and
Ä)
> is it not very inefficient?
It depends, you should minimise the list of characters in the
upper/lowercase variable as good as you can. The runtime should be
O(length($string)*length($uppercase))
and I don't know how to make it any faster
> my xml needs to support other languages, do i need to worry about letters
> with accents? do they have uppercase versions too?
Ask someone who knows the language, e.g. there is no uppercase version
of ß in German.
BTW: my keyboard does not support the funky german characters, and I've
therefor used html entites I hope you can read them ;-)
--
Goetz Bock IT Consultant
Dipl.-Inf. Univ.
PGP signature