?
Solved

XSLT to encode the Nordic characters

Posted on 2004-09-08
5
Medium Priority
?
790 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 375 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

770 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