我有一个包含 html 代码的 XML,就像:
<description>
<p>This is an very cute tiny bear!</p>
</description>
如何使用 XSLT 转换它:
<div>
<p>This is an very cute tiny bear!</p>
</div>
p 标签将被视为 html 标签。
最佳答案
我用 saxon XSLT 处理器测试了这段代码。它工作正常。
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<div>
<xsl:value-of select="/description" disable-output-escaping="yes"/>
</div>
</xsl:template>
</xsl:stylesheet>
关于html - 如何在 XSLT 中插入 html 文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39161929/