This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
Joined: Sep 24, 2004
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.
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.