【发布时间】:2010-04-24 16:02:11
【问题描述】:
我想将(使用 jquery.xslt.js)xml 转换为在文本节点中保留标签。 XML 看起来像:
<example>
<text>
Some text with <br /> and <img src="source" /> then text ....
</text>
</example>
我想拥有:
<div class="example">
<p>Some text with <br /> and <img src="source" /> then text ....</p>
</div>
如果我使用<xsl:value-of select="."/> 我会得到
"Some text with and then text ...."
如果我添加<xsl:apply-templates /> 我会得到
"Some text with and then text .... <br/><img src="source" />"
有什么方法可以精确重写标签的内容吗?
【问题讨论】: