本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
暂无公告...

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:
日志总数:10
评论数量:25
留言数量:0
访问次数:89393
建立时间:2005年3月7日




[xml]Transformiix不支持disable-output-escaping的解决方法
文章收藏

guan1200 发表于 2005/7/14 16:57:28

Transformiix不支持disable-output-escaping的解决方法 最近写了一个多浏览器兼容的XSLT程序,主要问题集中在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>


阅读全文(3747) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.020 second(s), page refreshed 144777534 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号