Subject: making special characters work
Posted By: Brian Campbell Post Date: 1/9/2007 5:18:16 PM
i have to put up both an english and french version of our terms of service document on the website.  the xsl parser yaks on characters such as é etc in the french TOS.  what's the easiest way to convert all these to a format that the parser will like that will also display properly in the HTML?

Reply By: mhkay Reply Date: 1/9/2007 5:39:29 PM
Your description of what you've done is very vague, and using words like "yaks" only makes it vaguer. Perhaps you have actually written the entity reference é in your stylesheet (or your source document) without declaring it? It's a fundamental rule in XML that except for the 5 built-in entities (<, etc) you can't use an entity reference unless you declare it first. You can get hold of standard files that declare all the HTML entity references to include in your document (but you'll have to search for them).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: Brian Campbell Reply Date: 1/9/2007 6:18:20 PM
I get the error "XML parser error 11: undefined entity" when things like « and è are in the code. I know i can use something like the following, but that gets obnoxious pretty fast...

<xsl:text disable-output-escaping="yes">&amp;egrave;</xsl:text>

Reply By: mhkay Reply Date: 1/9/2007 6:33:22 PM
You can download files that declare these entities from

http://www.oasis-open.org/docbook/xmlcharent/0.3/index.shtml

and incorporate them in your stylesheet by means of an internal DTD.

(Personally though, if I'm using Western European characters I prefer just to use iso-8859-1 encoding and enter the characters directly in their native encoding, rather than using entity references for them.)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: Brian Campbell Reply Date: 1/10/2007 2:43:17 PM
perfect, thank you!


Go to topic 54427

Return to index page 67
Return to index page 66
Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62
Return to index page 61
Return to index page 60
Return to index page 59
Return to index page 58