Solved

XSLT to encode the Nordic characters

Posted on 2004-09-08
5
770 Views
Last Modified: 2013-12-03
Hello experts,
Can any of you give a piece of code in xslt using CDATA which can be used to convert nordic characters.

I am sure that you all will know how the nordic characters will look. I need to encode them to be displayed correctly.
I can also do so by changing the encoding format to UTF-8. But i am not allowed to change the encoding standard.

I want a xslt which can do the above.


Thanks in advance,
bhalpa
0
Comment
Question by:bhalpa
  • 2
  • 2
5 Comments
 
LVL 26

Expert Comment

by:rdcpro
ID: 12007371
CDATA isn't going to help you here--it's merely a way of using characters that would otherwise be considered markup, like < and >.  

To display them, you need two things:

1.  text in an encoding that contains code points for the characters you want to use.  

2.  A system installed font that contains glyphs representng those characters.


What encoding does your XML use?  What encodings are you "allowed" to use?  Frankly UTF-8 or UTF-16 would be good choices, but if not, use one of the latin encodings, like ISO-8859-15.

Regards,
Mike Sharp
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 12013361
you can replace all nordic characters to their entities, if document encoding doesn't contain code points for it, but you still need font with right glyphs.
0
 

Author Comment

by:bhalpa
ID: 12131440
Hi dualsoul,

Yes I need to replace all nordic characters to their entities. Can you give me an example of doing so? I would appreiciate if the answer is given ASAP.

Thanks in advance,
Bhalpa

0
 
LVL 26

Accepted Solution

by:
rdcpro earned 125 total points
ID: 12137034
What encoding are you using??   If the encoding is messed up (say, because you're using ISO-8859-1), then you're using the wrong encoding.  If you want Nordic characters, and for some reason you want an ISO character set, use ISO-8859-10.  

You say you can't change the encoding, but you haven't said what encoding that you are using--it may not need to be changed.  

To use a character entity represention of any character, nordic or otherwise, you use &#x[HEXCODE];

For example, the 27th, 28th and 29th characters in Norway and Swedish alphabets are:

Norway
æ = &#x00E6;
Æ = &#x00C6;
ø = &#x00F8;
Ø = &#x00D8;
å = &#x00E5;
Å = &#x00C5;

Sweden
å = &#x00E5;  
Å = &#x00C5;
ä = &#x00E4;
Ä = &#x00C4;
ö = &#x00F6;
Ö = &#x00D6;


The HTML codes for these are:

æ = &aelig;
Æ = &AElig;
ä = &auml;
Ä = &Auml;
ø = &oslash;
Ø = &Oslash;
ö = &ouml;
Ö = &Ouml;
å = &aring;
Å = &Aring;

But of course you can't use HTML entities in XML.

But, you really need to provide us with more information.  You don't "Convert" nordic characters...they are simply code points in a particular encoding.  What is it you're trying to accomplish?

Regards,
Mike Sharp
0
 

Author Comment

by:bhalpa
ID: 12521843
Hi expert,

I don't want to use Nordic char in my web page. The actual scenario is like this. We get a search result as xml file which will have these charecters. When i try to transform using xslt it gives me an error cannot parse this.

I need to tell the parser that if it encounters the nordic chac, replace them with the english char and then move on
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question