FireFox不支持disable-output-escaping解决办法
来源:互联网 发布:月相手表 知乎 编辑:程序博客网 时间:2024/06/03 18:05
Transformiix不支持disable-output-escaping的解决方法
我接触到的内嵌在浏览器中的XSLT Processor主要是两种:MSIE的MSXML;包括Netscape、Mozilla、Firefox等浏览器用的都是Mozilla的Transformiix。
在http://www.w3.org/TR/xslt对XSLT的标准中,
http://www.w3.org/TR/xslt#output提到:“An XSLT processor may output the result tree as a sequence of
bytes, although it is not required to be able to do so[17
Conformance]“
http://www.w3.org/TR/xslt#disable-output-escaping:“An XSLT processor is not required to support disabling
output escaping.“
很不幸,Transformiix不支持disable-output-escaping
由于在我的XML文件中,需要在浏览器上正常显示CDATA中的HTML代码,这在MSIE中,调用disable-output-escaping当然没有问题,但是既然要多浏览器兼容,就不得不考虑在Transformiix中的情况,其实这完全可以通过javascript解决,国外网站上已经有了一些解决方案,结合我的实际情况,下面给出实例代码:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="GB2312" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="mynode">
<html>
<head>
<title>
</title>
</head>
<body>
<center id="content">
<xsl:apply-templates select="text"/>
</center>
</body>
</html>
</xsl:template>
<xsl:template match="text">
<xsl:value-of disable-output-escaping="yes" select="."/>
<xsl:if test="system-property('xsl:vendor')='Transformiix'">
<script language="JavaScript">
var el = document.getElementById("content");
el.innerHTML = el.firstChild.data;
</script>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
是不是很简单,呵呵
http://www.forum4designers.com/archive88-2005-4-211776.html
http://use.perl.org/~TorgoX/journal/24272
http://www.xml.com/pub/a/2003/08/20/embedded.html
解决方法二:
使用<xsl:copy-of />
- FireFox不支持disable-output-escaping解决办法
- disable-output-escaping属性
- disable-output-escaping
- Firefox不支持document.frames["tmpFrame"].location解决办法
- Firefox不支持document.frames["tmpFrame"].location解决办法
- Firefox不支持removeNode及window.event解决办法
- 【坑】Firefox不支持window.event的解决办法
- Disable Firefox Image Drag
- tomcat disable catalina.out output
- document.all在firefox中不支持的解决办法
- 关于firefox不支持text-overflow:ellipsis;的解决办法
- Disable select in Mozilla Firefox
- How to disable firefox cache
- firefox不支持innerText
- firefox不支持innerText
- FireFox不支持outerHTML,怎么办?
- CSDN博客不支持FireFox?
- FireFox不支持outerHTML,怎么办?
- GridView CheckBox当翻页时保存选中的项(viewstate)
- 失败教训:可口可乐百年来最大的营销失误
- symfony03_3:探索symfony代码
- avgamsvr.exe
- sybase for linux 安装一
- FireFox不支持disable-output-escaping解决办法
- 毕业了,找工作ing!
- SOA介绍
- 周星驰:卑微是人生第一课
- 反击帝国主义侵略,金融战已从中国房市打响
- avgcc.exe
- 文本文件中的数据导入到Oracle数据库表
- 如何迅速成为Java高手
- symfony04:Symfony核心类