Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unescape XML characters with help of XSLT?

Tags:

xml

xslt

I need to unescape XML characters from inside of XML nodes with the help of only XSLT transformations. I have <text>&lt;&gt;and other possible characters</text> and need to get it as valid formatted HTML when I place it inside of the body tag.

like image 953
Artsiom Anisimau Avatar asked Mar 17 '10 14:03

Artsiom Anisimau


1 Answers

<xsl:template match="text">
  <body>
    <xsl:value-of select="." disable-output-escaping="yes" />
  </body>
</xsl:template>

Note that the output is not guaranteed to be well-formed XML anymore.

like image 199
Tomalak Avatar answered Sep 17 '22 12:09

Tomalak