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

所属分类: 网络编程 / CSS/HTML 阅读数: 1378
收藏 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.

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

IE 5.x/Win 和模型bug

IE 5.x/Win 和模型bug
收藏 0 赞 0 分享

各浏览器padding、margin的差异

各浏览器padding、margin的差异
收藏 0 赞 0 分享

IE浮动边界BUG延伸探讨

IE浮动边界BUG延伸探讨
收藏 0 赞 0 分享

[转]目前找到的最好的Iframe自适应高度代码

[转]目前找到的最好的Iframe自适应高度代码
收藏 0 赞 0 分享

Web Safe Color Pallette

Web Safe Color Pallette
收藏 0 赞 0 分享

网站制作之网页技巧

网站制作之网页技巧
收藏 0 赞 0 分享

http状态码一览表

网站的http状态对于网站维护人员来说是相当重要的,当网站出现问题的时候,我们首先要诊断一下网站的http状态,从而进一步确认哪里出现的问题
收藏 0 赞 0 分享

从Table向Css过渡的优缺点比较

从Table向Css过渡的优缺点比较
收藏 0 赞 0 分享

不用float实现div模块居中布局

不用float实现div模块居中布局
收藏 0 赞 0 分享

解决列高度自适应(相同)的五种方法

解决列高度自适应(相同)的五种方法
收藏 0 赞 0 分享
查看更多