Subject: [xsl] mystery #3: rendering embedded HTML From: Gary Lawrence Murphy <garym@xxxxxxxxxx> Date: 13 Apr 2002 01:54:36 -0400 |
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@xxxxxxxxxxx> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] mystery #2: testing docum, Gary Lawrence Murphy | Thread | RE: [xsl] mystery #3: rendering emb, Oleg Tkachenko |
[xsl] XSLT Processing Model Questio, Dietrich Ayala | Date | Re: [xsl] mystery #2: testing docum, David Carlisle |
Month |