Subject: RE: How to output element containing HTML? From: Mike Brown <mbrown@xxxxxxxxxxxxx> Date: Tue, 24 Aug 1999 18:37:16 -0600 |
> Is this a fundamental problem with XSL? I have an > element that may or may not be well formed XML > (user entered HTML). I want to insert it directly > without any special quoting into a stylesheet output. There simply is no getting around the fact that your XSL stylesheet must produce a well-formed result tree that could be represented as another XML document. From this result tree some kind of actual output such as HTML 4.0 will be derived. It's not a fundamental problem that XSL won't let you force part of the result tree to not be well-formed. Your goal should be to create a well-formed result tree that somehow contains the crappy user data. You'll have to treat the user data strictly as CDATA and put it in a text node, and then you'll want to tell the XSL processor to handle the HTML output of that part of the tree specially. As of the latest XSLT working draft, there is the disable-output-escaping functionality for text nodes, which will allow that user data to be output with literal < > angle brackets instead of < and > entities. You may find that this isn't always as useful as you'd think, but you *should* be able to use <xsl:value-of select="MESSAGE_BODY" disable-output-escaping="yes"/> with your <MESSAGE_BODY><![CDATA[ <A HREF="http://domain.com">http://domain.com</A> ]]></MESSAGE_BODY> to create a special text node in the result tree. The contents of the text node will be the CDATA (you were right about that part) and the presence of the disable-output-escaping="yes" will cause a conforming XSL processor to flag that node as not requiring special characters to be entified. - Mike ________________________________________________________________________ Mike Brown / Hyperreal | Hyperreal http://www.hyperreal.org/music/ PO Box 61334 | XML & XSL http://www.skew.org/xml/ Denver CO 80206-8334 USA | http://www.hyperreal.org/~mike/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
How to output element containing HT, Peter Bryant | Thread | FW: XSL:copy problems, Paul Beer |
How to output element containing HT, Peter Bryant | Date | FW: XSL:copy problems, Paul Beer |
Month |