Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to fix the weird characters from displaying in xsl output?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have my xsl code like this:



I get these weird characters in my xsl output like "Sterlite's optical fiber enhanced for G.657A compliance". I tried the ISO-8859-1 encoding, but that does not seem to help either. Does anyone have ideas on how to get the apostrophe to display insetad of the numeric value of the character to display?
Thanks in advance.



 
Marshal
Posts: 25838
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any "weird" characters in your post.

Are you saying you see "&" or something like that when you look at the output of your transformation in a text editor? Browsers will automatically interpret character entities like that as the characters they are meant to represent. Try it in a browser and you will see that.
 
Nina Binde
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the weird characters that Paul mentioned "& #39;" . It is appearing that way when I view on a browser. I am not sure how to fix it. The xml encoding I have is:


When this is transformed to xsl with html output, I thought it will interpret all the UTF-8 characters appropriately. It is not doing so.

I have tried this one too with the xsl output:


Nothing seems to help.

Thanks for any replies.
 
Paul Clapham
Marshal
Posts: 25838
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps they are in the input document like that. If so, then the transformation wouldn't change them. Or perhaps something in the transformation is incorrectly inserting them like that.

The output encoding has essentially nothing to do with the question. The question is all about how to type a character entity in an XML document (or I am guessing that is the question, because we don't know anything about the input document or the transformation.)

If you want to put an apostrophe into a text node, it is possible to put it there as a character entity. (You may want to do that because the text is an attribute value which is already surrounded by apostrophes, for example.) The character entity would look like this: '

If there is a space in the middle, like this, then it isn't a character entity: & #39; In that case it is an ampersand followed by some text. As in what you say you are seeing in your browser.

So go through your input and transformation and find out where this broken character entity is coming from. Try to fix it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic