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

RE: How to output element containing HTML?

Subject: RE: How to output element containing HTML?
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Tue, 24 Aug 1999 18:37:16 -0600
xslt text containing html
> 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 &lt; and &gt; 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

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.