首页 文章

使用xslt在xml中显示xml元素

提问于
浏览
0

我使用XSLT 1.0,我有一个XML,看起来像这样

<item name="note"><value>&lt;p&gt;Add the &amp;lt;bean&amp;gt; tag pased below to the &amp;lt;beans&amp;gt; element in this file .... </value></item>

我想在HTML中显示它

Add the <bean> tag passed below to the <beans> element in this file.

请注意,当我使用disable-output-escaping = yes时,<p>将转换为段落标记 .

这就是我在xslt中的含义

<xsl:template match="item[@name='note']">
    <xsl:value-of select="value" disable-output-escaping="yes" />
</xsl:template>

使用这个xslt它会忽略bean和beans xml,它不会显示在页面中 . 我如何确保以我想要的方式显示它?

1 回答

  • 0

    问题是你的一些实体已经"double escaped" .
    &amp;lt;bean&amp;gt; 应为 &lt;bean&gt;

相关问题