XSL:让原始HTML通过 [英] XSL: let raw HTML through
本文介绍了XSL:让原始HTML通过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< xml>
< text>
< p>< b> Hello< / b>< em> There< / em>< / p>
< / text>
< / xml>
应用转换:
< xsl:template match =text>
< div class ={name()} input>
< xsl:value-of select =。/>
< / div>
< / xsl:template>
我得到了输出:
< div class =text input>
您好!有
< / div>
但我希望Html保持原样:
< div class =text input>
< p>< b> Hello< / b>< em> There< / em>< / p>
< / div>用节点()代替。 函数给出了相同的结果。
有没有一种通过转换获得HTML的方法未经修改?
解决方案查看 xsl:copy-of
它应该做你需要的东西。
< xsl:copy-of select = />
以上将选择整个当前节点,因此在您的情况下,<文本>
本身将被包括在内。
使用以下命令选择当前的所有内容。
< xsl:copy-of select =child :: node()/>
Im making a XSL transform. The XML I'm transforming has a node which contains html.
<xml>
<text>
<p><b>Hello</b><em>There</em></p>
</text>
</xml>
Applying the transform:
<xsl:template match="text">
<div class="{name()} input">
<xsl:value-of select="."/>
</div>
</xsl:template>
I get the output:
<div class="text input">
Hello There
</div>
But I want the Html to remain intact like so:
<div class="text input">
<p><b>Hello</b><em>There</em></p>
</div>
Substituting . with the node() function gives the same result.
Is there a method of getting the HTML through the transform unmodified?
解决方案 Have a look at xsl:copy-of
It should do what you need..
<xsl:copy-of select="." />
The above will select the whole current node so in your case the <text>
itself will be included..
Use the following to select everything under the current..
<xsl:copy-of select="child::node()" />
这篇关于XSL:让原始HTML通过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文