[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: nbsp fails transformation
If someone sends you a document that isn't well-formed XML, the best strategy is to get the people who produced it to mend their ways. True. However, having in an XML file and finding out that all of a sudden XML is not XML anymore must be among the most frequent unpleasant surprises fresh XML programmers have to deal with. I believe it was among one of my first questions to this list as well. And my first reaction was: that cannot be, everybody knows , how can it _not_ be XML? The thing is, XML is a very generic and expandable language, and entities is one thing that can be expanded upon (above the five that are always allowed: < > &, &apos and "). This is done by declaring entities in DTD declarations like Patrick suggested, or can be done by using an external DTD file and link to it. If your input comes from XHTML or HTML, this happens often. The fix is to use the original doctype declaration and make sure that the DTD's it refers to are available. That way other entities like —, ¨ © are also recognized in the majority of cases. You can find the declaration of all these entities here: http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Latin-1_characters, it also shows a typical declaration for use in XML. Download the file at http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent, use it locally to refer to it and you can work with almost all XHTML/HTML input, as long as the rest is well-formed. Kind regards, Abel Braaksma ------------------------------------------------------------------------ From: Michael Kay <mike@xxxxxxxxxxxx> Sent: Wednesday, August 10, 2011 10:19:17 AM To: xsl-list Cc: Subject: Re: nbsp fails transformation
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|