HTML in XSL StyleSheet?

Post Reply
cwd
Posts: 8
Joined: Wed Mar 08, 2006 7:51 pm

HTML in XSL StyleSheet?

Post by cwd »

Is there anyway to put html in to the XSL Stylesheet, this is a large page and would take awhile to convert to xml format. Is it possible to use the TopHTML and BottomHTML values somewhere or some other way of doing it?
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

HTML in XSL StyleSheet?

Post by jason112 »

No, a XSL stylesheet is by definition XML, so any XSL stylesheet would have to be valid XML.

The applying of the XSL is completely separate from the regular "look and feel" settings, which is what TopHTML and BottomHTML are a part of.
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

HTML in XSL StyleSheet?

Post by jason112 »

And of course, right after I hit "Add to Thread" a
lightbulb goes off in my head and I realize a way to do it, with a combination of D-O-E and CDATA blocks.

<xsl:template match="ThunderstoneResults">
.....
<BODY BGCOLOR="white">
<xsl:text disable-output-escaping="yes">
<![CDATA[
I'm unbalanced HTML! <br><br><br> Can't see me!
]]>
</xsl:text>
</BODY>
</XSL:template>

Including any HTML inside DOE & CDATA blocks should do
what you want.
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

HTML in XSL StyleSheet?

Post by jason112 »

It should be noted that this should be a temporary measure, as disable-output-escaping is largely frowned upon by the XSL community as dangerous. The spec is very unclear as to how exactly it should be handled, so browsers can vary on how they implemented it (Mozilla/Firefox seem to have lots of problems with it).

For this situation, though, it'll be applied server-side so it should be ok for now.
Post Reply