Today I used XSLT to convert XML and found that the HTML code in XML was not displayed normally. for example:
XML file:
<root>
<date><![CDATA[<img border=0 src='images/w3china_logo.gif'>]]</date>
</root>
XSLT file:
<xsl:value-of select="root/date" >
I found that the image I'm trying to display in this input is <img border=0 src='images/w3china_logo.gif'>, but I actually want to display it. I found a solution to the problem online and shared it. I hope I can use it if I don’t understand it in the future.
Just change the XSLT file to this:
<xsl:value-of select="remark" disable-output-escaping="yes"/>
XML file:
<root>
<date><![CDATA[<img border=0 src='images/w3china_logo.gif'>]]</date>
</root>
XSLT file:
<xsl:value-of select="root/date" >
I found that the image I'm trying to display in this input is <img border=0 src='images/w3china_logo.gif'>, but I actually want to display it. I found a solution to the problem online and shared it. I hope I can use it if I don’t understand it in the future.
Just change the XSLT file to this:
<xsl:value-of select="remark" disable-output-escaping="yes"/>