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

发布时间:2022-04-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
前不久我写过 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.

脚本宝典总结

以上是脚本宝典为你收集整理的把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。全部内容,希望文章能够帮你解决把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:CDATACDATA