我正在进行XSL转换.我正在转换的
XML有一个包含html的节点.
@H_301_2@<xml>
<text>
<p><b>Hello</b><em>There</em></p>
</text>
</xml>
应用转换:
@H_301_2@<xsl:template match="text"> <div class="{name()} input"> <xsl:value-of select="."/> </div> </xsl:template>我得到输出:
@H_301_2@<div class="text input"> Hello There </div>但我希望Html保持原样如下:
@H_301_2@<div class="text input"> <p><b>Hello</b><em>There</em></p> </div>代替.使用node()函数可以得到相同的结果.
解决方法
看看
xsl:copy-of
它应该做你需要的……
@H_301_2@<xsl:copy-of select="." />以上将选择整个当前节点,因此在您的情况下< text>本身将包括在内..
使用以下选项来选择当前的所有内容..
@H_301_2@<xsl:copy-of select="child::node()" />