Friday, April 18, 2008

how to use xHTML tags with XSLT

on my current task i started to use XSLT heavily. i have a set of XML-files and when anybody viewing them, browser applies specified XSLT-file.

as more than i used combinations of this technologies, was very impressed how things can be done easily.

today i got some issue. i had some code portion in XML that contains xHTML tags.

XML content:

<output><![CDATA[
<em>err assertFalse</em>
out assertFalse
failure assertFalse(junit.SimpleTest1): error message
]]></output>


XSLT formatting:

<pre>
<xsl:value-of select="output"/>
</pre>


so i need to show this output content to user using inside xHTML tags, so first line expected to be emphasized. but it not! all because, XSL processor escaping special characters by default ("<" to "&lt;") to make valid output.

i found helpful links on Dev Shed forum. all you need, is to add disable-output-escaping="yes".


<pre>
<xsl:value-of select="output" disable-output-escaping="yes"/>
</pre>


btw, it's working only in IE-family and Safari. it's funny discussion at FF bugzilla started 2001-09-04 and to thus far.

Friday, April 11, 2008

get firefox or opera, not IE