This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: upper case



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. &auml; and
&Auml;)

> 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 &szlig; 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]