[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] mystery #3: rendering embedded HTML
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
|
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
|