By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

Converting Case - Umlauts?

P: n/a
I use the following to convert uppercase to lowercase:

translate($queryString, 'ABCDE...', 'abcde...')

But how can i convert the case for umlauts? etc

Oct 26 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a


jo********@gmail.com wrote:
I use the following to convert uppercase to lowercase:

translate($queryString, 'ABCDE...', 'abcde...')

But how can i convert the case for umlauts? etc


Pretty much the same, each character in the second argument to translate
is replaced by the character at the same index in the third argument so
you simply need to make sure you have all characters you care about in
upper case as the second argument and the same characters in the same
order as the third argument e.g. global variables

<xsl:variable
name="iso88591UpperCaseLetters"
select="ABCDEFGHIJKLMNOPQRSTUVWXYZ " />
<xsl:variable
name="iso88591LowerCaseLetters"
select="abcdefghijklmnopqrstuvwxyz " />

then use e.g.

translate($queryString, $iso88591UpperCaseLetters,
$iso88591LowerCaseLetters)

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 26 '05 #2

P: n/a
This doesnt work, I am using UTF-8.

http://www.jeria.net/XSLT/

type in "gy" and press submit, you will get a "ablotron error on line
11: XML parser error 4: not well-formed (invalid token)" error.

Xml and xslt files can be found here
http://www.jeria.net/XSLT/xml/

Oct 26 '05 #3

P: n/a
Oh, sorry, it now works, changed to ISO-8859-1

Thanks

Oct 26 '05 #4

P: n/a


Martin Honnen wrote:

<xsl:variable
name="iso88591UpperCaseLetters"
select="ABCDEFGHIJKLMNOPQRSTUVWXYZ " />
<xsl:variable
name="iso88591LowerCaseLetters"
select="abcdefghijklmnopqrstuvwxyz " />


Should be

<xsl:variable
name="iso88591UpperCaseLetters"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ '" />
<xsl:variable
name="iso88591LowerCaseLetters"
select="'abcdefghijklmnopqrstuvwxyz '" />

of course.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 26 '05 #5

P: n/a
On Wed, 26 Oct 2005, Martin Honnen wrote:
name="iso88591UpperCaseLetters"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ '" /> ^ name="iso88591LowerCaseLetters"
select="'abcdefghijklmnopqrstuvwxyz '" />

^

The multiplication sign () isn't exactly a letter.
However, "sharp s" and "y with diaeresis" are.

--
Netscape 3.04 does everything I need, and it's utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>

Oct 26 '05 #6

P: n/a
On Wed, 26 Oct 2005, Andreas Prilop wrote:
On Wed, 26 Oct 2005, Martin Honnen wrote:
name="iso88591UpperCaseLetters"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ '" /> ^
name="iso88591LowerCaseLetters"
select="'abcdefghijklmnopqrstuvwxyz '" />


The multiplication sign () isn't exactly a letter.


Granted...
However, "sharp s" and "y with diaeresis" are.


What you going to do with them then, in an iso-8859-1 context? ;-)
Oct 26 '05 #7

P: n/a
On Wed, 26 Oct 2005, Alan J. Flavell wrote:
However, "sharp s" and "y with diaeresis" are.


What you going to do with them then, in an iso-8859-1 context? ;-)


When converting from lower-case to upper-case, "" becomes "SS".
"" might become "Y" without accents in ISO-8859-1.

But this leads me to a more interesting ... err ... case:

In Greek, there are no accents when a word is written in capitals.
For example (I use romanization here):
"Ells" has an accent on "alpha", whereas
"ELLAS" has no accent on "Alpha".
Therefore "Alpha" might be considered as an upper-case form
of "alpha with tonos".

Even the proper name "lan" converts to "ALAN" in caps.
Therefore "Alpha" might be considered as an upper-case form
of "Alpha with tonos". Strange? Yes.

I cannot find anything about this in
http://www.unicode.org/Public/UNIDATA/CaseFolding.txt

--
Netscape 3.04 does everything I need, and it's utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>

Oct 27 '05 #8

P: n/a
Would it be possible solving this issue using UTF-8? When using UTF-8
these charachters apperas as question marks.

Nov 1 '05 #9

P: n/a


Andreas Prilop wrote:
On Wed, 26 Oct 2005, Martin Honnen wrote:
name="iso88591LowerCaseLetters"
select="'abcdefghijklmnopqrstuvwxyz '" />
^

The multiplication sign () isn't exactly a letter.


Right, I was simply to lazy to copy anything by hand from a list of
defined letters and generated those strings programmatically from
character codes. For the XPath use with the translate function it does
not matter semantically as long as the second and the third argument
have the same length and that sign is at the same position in both
arguments, then no conversion/translation happens.
However, "sharp s" and "y with diaeresis" are.


But using XPath 1.0 translate it is only possible to translate one
character into another but not one into a sequence of others so for to
SS translatation the suggested approach with translate is not going to work.

I guess I just need to be more careful to name my variables and not have
them reference a standard when the variable use is not quite up to the
standard :).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 1 '05 #10

P: n/a
In <11**********************@g49g2000cwa.googlegroups .com>, on
11/01/2005
at 04:24 AM, jo********@gmail.com said:
Would it be possible solving this issue using UTF-8? When using UTF-8
these charachters apperas as question marks.


Are you sure that you are using the correct octets for UTF-8? If each
character only takes one octet then you're probably storing the data
as ISO-8859-1 or -15, e.g.,

a" E4
e" EB
i" EF
o" F6
u" FC
A" C4
E" CB
I" CF
O" D6
U" DC

--
Shmuel (Seymour J.) Metz, SysProg and JOAT
<http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the right
to publicly post or ridicule any abusive E-mail. Reply to domain
Patriot dot net user shmuel+news to contact me. Do not reply to
sp******@library.lspace.org

Nov 1 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.