我有如下的XML:
<Test>
<Content>
<innerHtml>
<div style="font-size:13px;">This letter should be wrap by div element.</div>
</innerHtml>
</Content>
</Test>
在XML样式表中,我将这种内容称为:
<xsl:value-of select="innerHtml"/>
并且问题在这里发生。我想要的是将“ innerHtml”节点的内容打印为HTML对象,而不是字符串。谢谢。
最佳答案
用:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//innerHtml"/>
</xsl:template>
<xsl:template match="innerHtml">
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
关于xml - 在XSL StyleSheet中将字符串作为HTML对象返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8356321/