把 CDATA 中的内容(有可能是不规范的Html代码)以Html方式展现出来。
2007-04-22 00:00
441 查看
前不久我写过 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.
注意: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方式展现出来。
- 读取xml文件内容,并将其内容以treeview的方式展现出来
- firefox 16 firebug问题 html模块显示不出来内容不显示内容
- HTML4.01规范中英文对照-HTML文档展现(1)
- 用HTML代码加载Unity内容 HTML code to load Unity content
- JS提取网页中表格内容,将特定列内的html文本中id,href,onclick属性提取出来
- HTML 5:富媒体时代的Web内容新规范,你准备好了吗?
- php在没用xdebug等调试工具的情况下如何让调试内容优雅地展现出来?--php数组格式化
- 前端html中jQuery实现对文本的搜索功能并把搜索相关内容显示出来
- js生成html---查询数据后自动生成相对应的html展现内容
- Flex中TextArea展现html内容
- HTML4.01规范中英文对照-HTML文档展现(2) (
- Web前端开发规范文档你需要知道的事--HTML、css、js、文档等需要规范内容
- WebBrowser控件,c++修改HTML中元素内容的一种方式
- HTML 5:富媒体时代的Web内容新规范
- HTML网页META标签内容写作规范要点
- js方法中获取开始标签和结束标签中间插入内容的方式(innerHTML/html())
- 一个实用的类,把DATATABLE中的内容用HTML的方式显示
- 使用脚本方式和使用控件方式来输出Html内容的区别
- 使用流加载和保存HTML内容&遍历html的信息存入一个ini文件&使用MSHTML分析HTML代码