[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Entity Problems...

Subject: Re: Entity Problems...
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 17 Aug 2007 18:41:42 +0200
Re:  Entity Problems...
If you cannot know beforehand what entities will be passed on, it is generally best to find online some big DTD that contains all allowed HTML entities (you mentioned &nbsp;, but perhaps your favorite editor throws in &uuml;, &cent;, &igrave; etc). You can get quite a definite list from the W3C of course, here's a starting point: http://www.w3.org/TR/REC-html40/sgml/entities.html#h-24.2.1

Alternatively (but *not* recommended!): if you use Saxon 8.9 you can read the document with unparsed-text(), do a replace on the entities manually (replacing them by their numeric equivalents) and reparse using saxon:parse. But, I'd vote against this as it goes against the idea of using the XML input the way you should. Using a catalog as David suggested is probably easier.

Finally: you ask for alternatives for an editor. I've done Tiny MCE but I did not like it (lack of standards support). I now use FCKEditor and it rocks (biased opinion!). A perfect (yet recent) addition to the configuration is that you can force it to output real XHTML 1.1 and you can have it replace all named entities for numeric ones. A definite partner when you need additional processing. The editor works with all major browsers (including safari, opera, konqeror) and is open source.

Cheers,
-- Abel Braaksma

Nick Shepherd wrote:
I use XSL in a homegrown content management system I wrote in php for
the templating system.  One of the problems I have encountered before
was the use of entities like "&nbsp;" and the such.  When not wrapped
in CDATA tags it would always give an error unless it was replaced
with the numeric equivalent.  This data not being wrapped in CDATA is
imperative because it is being used to output html that has been
inputed from a textarea to the screen using xsl:copy-of...

Now to my question, although basic compared to the questions generally
asked on this list, is there any way to prevent these entities from
producing errors?  We've come to a point with one of our products that
allows users to create their own websites and this type of
functionality is needed because the rich text editor of choice loves
to throw "&nbsp;" everywhere (tiny mce).  Any ideas?  Or alternatives
to the rich text editor that would allow non-techy users to edit the
look and feel of their content on their sites?

Nick Shepherd

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.