How to use XSLT with XML that contains HTML source.?
I am writing a forum and using XSLT to print messages from it. Every message may contain XHTML tags.
Assume that every message is a valid XHTML in itself (every tag is properly closed, etc...). How do I output this embedded XHTML via the XSLT? The inner HTML tags get chopped by the transformation, and I only get the text itself.
Currently my XSLT looks something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<tr>
<td><strong>Title</strong></td>
<td><strong>Message</strong></td>
</tr>
<xsl:for-each select="message_list_2/message">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="body"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
Mike, I know how to link XML documents to XSLT. The problem is the XML contains elements that I want to keep in the translation, but they are lost. If a certain <body> element in the example contains "<b>foo</b>", I want to print this entire string, not just "foo".
Besides, I'm using a server-side XSLT engine, not that it matters in this case.
|