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

2022-04-15 0 803

前不久我写过 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.

免责声明:
1、本网站所有发布的源码、软件和资料均为收集各大资源网站整理而来;仅限用于学习和研究目的,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。 不得使用于非法商业用途,不得违反国家法律。否则后果自负!

2、本站信息来自网络,版权争议与本站无关。一切关于该资源商业行为与www.niceym.com无关。
如果您喜欢该程序,请支持正版源码、软件,购买注册,得到更好的正版服务。
如有侵犯你版权的,请邮件与我们联系处理(邮箱:skknet@qq.com),本站将立即改正。

NICE源码网 CSS/HTML 把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。 https://www.niceym.com/16714.html