如何在 XSLT 的帮助下对 XML 字符进行转义? [英] How to unescape XML characters with help of XSLT?

查看:26
本文介绍了如何在 XSLT 的帮助下对 XML 字符进行转义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要仅在 XSLT 转换的帮助下从 XML 节点内部转义 XML 字符.我有 <text>&lt;>和其他可能的字符</text>,当我将它放在 body 标签中时,需要将其作为有效的格式化 HTML.>

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.

推荐答案

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

请注意,不再保证输出是格式良好的 XML.

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

这篇关于如何在 XSLT 的帮助下对 XML 字符进行转义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆