This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
mystery #3: rendering embedded HTML
- From: Gary Lawrence Murphy <garym at canada dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: 13 Apr 2002 01:54:36 -0400
- Subject: [xsl] mystery #3: rendering embedded HTML
- Organization: TCI Business Innovation through Open Source Computing
- References: <m2g0208no7.fsf@maya.dyndns.org>
- Reply-to: xsl-list at lists dot mulberrytech dot com
The last mystery for me for one day ;) -- this one I've heard can be
done with msxml extensions, but I'd prefer a portable solution:
Can I restore HTML that has been encoded as CDATA escaped PCDATA?
Here's a scenario: Users enter free-hand (often broken) HTML into a
webform textarea edit box. Their text is wrapped in an XML envelope,
their HTML enclosed by <![CDATA[ ]]> to escape all the <>& chars and
so the broken markup will parse. This envelope XML document is
stored, transported, retrieved and unpacked so the original
user-entered HTML can be displayed on a weblog. This is more or less
the inverse of "disable-output-escaping": I don't want to pass literal
chars, I need to resolve entities _back_ to their literal chars.
In pure Java (JDOM/Jaxen/XPath), I can xpath the text node and print
its contents to the servlet output stream; the result will be the
HTML I expect to see and renders correctly in the browser.
In XSL, the <>& chars remain escaped; the html appears as its codes.
Is there a portable way to 'eval' a value-of string to undo the effect
of CDATA escaping? Is this the best way to embed HTML into an XML
document?
--
Gary Lawrence Murphy <garym@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list