如何保留标记标签? [英] How do I preserve markup tags?

查看:20
本文介绍了如何保留标记标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含新闻报道的 XML 文档,新闻报道的正文元素在纯文本中包含 p 个标签.当我使用 XSL 检索正文时,例如

I've got an XML document containing news stories, and the body element of a news story contains p tags amongst the plain text. When I use XSL to retrieve the body, e.g.

<xsl:value-of select="body" />

p 标签似乎被剥离了.我正在使用 Visual Studio 2005 的 XSL 实现.

the p tags seem to get stripped out. I'm using Visual Studio 2005's implementation of XSL.

有没有人有任何想法如何避免这种情况?谢谢.

Does anyone have any ideas how to avoid this? Thanks.

推荐答案

尝试使用

<xsl:copy-of select="body"/>

相反.来自 w3schools 的文档:

元素创建一个当前节点的副本.

The <xsl:copy-of> element creates a copy of the current node.

注意:命名空间节点、子节点、当前节点的属性是也会自动复制!

Note: Namespace nodes, child nodes, and attributes of the current node are automatically copied as well!

这篇关于如何保留标记标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆