把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。

所属分类: 网络编程 / CSS/HTML 阅读数: 1438
收藏 0 赞 0 分享
前不久我写过 XML+XSL 与 Html 的结合 文章,之后有人问我如何把 CDATA 中的内容以Html方式展现出来(尤其是用户写的Html不规范)。本来想写个范例,后来到Google上一查,发现已经有人写了。就在:http://java.blogger.cn/wuyu/posts/1460.aspx


注意:xsl的disable-output-escaping="yes" 

其核心就是利用 disable-output-escaping="yes" 

MSDN 上对它的描述如下:

disable-output-escaping 
Default is "no". If the value is "yes", a text node generated by instantiating the element will be output without any escaping. For example, the following generates the single character "<". 
<
Note?? disable-output-escaping="yes" can be used to generate non-well-formed documents, and thus should be used with caution, because non-well-formed output may generate errors in certain circumstances. For example, transformNodeToObject to an XML document requires that the result be well-formed and thus may not complete ifdisable-output-escaping has affected the well-formedness of the document. Consider disable-output-escaping="yes" an advanced feature to be used only when the potential dangers are understood.

更多精彩内容其他人还在看

input文本框样式代码实例

input文本框样式代码实例
收藏 0 赞 0 分享

div+css实现自适应宽度按钮

div+css实现自适应宽度按钮
收藏 0 赞 0 分享

h1标签的使用技巧

h1标签的使用技巧
收藏 0 赞 0 分享

base href 使用方法详解

base href 使用方法详解
收藏 0 赞 0 分享

html label标签的使用教程

html label标签的使用教程
收藏 0 赞 0 分享

使用CSS不用程序实现文字自动截断 用省略号代替

使用CSS不用程序实现文字自动截断 用省略号代替
收藏 0 赞 0 分享

CSS hack实现 CSS完美兼容IE6/IE7/FF的通用方法

CSS hack实现 CSS完美兼容IE6/IE7/FF的通用方法
收藏 0 赞 0 分享

网页布局+纯CSS纵向下拉菜单 IE6/IE7兼容

网页布局+纯CSS纵向下拉菜单 IE6/IE7兼容
收藏 0 赞 0 分享

CSS图片拼合生成器只需上传zip包即可

CSS图片拼合生成器只需上传zip包即可
收藏 0 赞 0 分享

用iframe margin实现调用其他网页的某一区域的方法

用iframe margin实现调用其他网页的某一区域的方法
收藏 0 赞 0 分享
查看更多