[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: upper case

Subject: Re: upper case
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Tue, 21 Aug 2001 15:32:02 +0200
make upper case in xslt
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.

Attachment: pgp00018.pgp
Description: PGP signature

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.