[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Html tags as part of XML elements rendered as text
Erickson, David wrote: > I use an XSL stylesheet to parse an XML document into html [...] in IE5. > <link><font face=helvetica size=2><b>this thing > costs</b><br>$219.00</font></text> I can't imagine that this would work with <link> being the start tag and </text> being the end tag. One of the concepts of XML is well-formedness, and it looks like you discovered a way to make your XML-that-contains-HTML well-formed by changing "<" to "<", but in so doing, you lost sight of the significance of the markup. When you change markup characters to entity or numeric character references, you are saying "this is not markup anymore; this is character data, and I want you to treat it like you would any other non-markup text". < in the source document *does* become "<" in the source tree and it can be copied into the result tree as such, but when the result tree is serialized as XML or HTML, it is escaped again as < because you said it's just character data, and we wouldn't want to make character data that could be confused with markup. You mustn't put arbitrary HTML, which can be non-well-formed, into your XML. You can, however, use XHTML: <link><font face="helvetica" size="2"><b>this thing costs</b><br />$219.00</font></link> ...and use xsl:copy-of rather than xsl:value-of to copy the whole thing. You can use xsl:copy-of if you have installed a newer version of MSXML than the one that shipped with IE5. See the IE5/MSXML FAQ that Joshua Allen posted a URL for today, if you don't know what I'm talking about. Without a current version of MSXML, you'll be running into many more problems and misunderstandings. If you're stuck with what you've got, you could do an "identity transform" instead of xsl:copy-of, but this would still require that you use the XHTML. You should also stop thinking of the process of creating HTML as a matter of serially pasting together strings of marked-up text. ASP, PHP, CFML, JHTML, JSP, and server-side includes are better tools for that job. With XML, XHTML and XSL/XSLT, you need to be thinking in terms of node trees that have been derived from XML and from which you can derive XML or HTML output, but not by specifying the output literally. - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://www.skew.org/xml/ 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
|