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

我的分类(专题)

公告

日志更新

最新评论

留言板

链接

Blog信息
blog名称:网络爬虫
日志总数:39
评论数量:202
留言数量:2
访问次数:246676
建立时间:2005年3月22日



[XML应用]使用XSL将XML文档中的CDATA注释输出为HTML文本
软件技术

网络爬虫 发表于 2005/5/3 18:24:50

示例代码 1.   test.xml <?xml version="1.0" encoding="gb2312"?><?xml-stylesheet href="test.xsl" type="text/xsl"?><entry> <title>entry with images</title> <date>August 09, 2003</date> <author>Kevin</author> <idnum>000033</idnum> <permalink>http://alazanto.org/xml/archives/000033.xml</permalink> <body xmlns:html="500)this.width=500'>http://www.w3.org/1999/xhtml"><![CDATA[<p><img  class="archive" align="right" src="http://alazanto.org/images/sample.jpg"  alt="photograph of a flower, just for show"/>Mauris felis elit, varius  quis, pulvinar vel, sodales vehicula, mi. Nunc elementum pharetra elit.  </p>]]> </body> <more xmlns:html="http://www.w3.org/1999/xhtml"><![CDATA[]]></more> <comment-link>http://alazanto.org/xml/archives/000033_comments.xml</comment-link> <comment-count>6</comment-count></entry> 2.  test.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/entry"> <html> <head> </head> <body> <xsl:value-of select="title" /> <xsl:value-of select="body" disable-output-escaping="yes"/> </body> </html> </xsl:template> </xsl:stylesheet> 关键之外在于使用的命名空间xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 和输出时加上disable-output-escaping="yes"


阅读全文(2494) | 回复(4) | 编辑 | 精华
 


回复:使用XSL将XML文档中的CDATA注释输出为HTML文本
软件技术

油炸鸡翅(游客)发表评论于2005/5/29 18:01:54

回楼上,foxfire我没用过,不知道如何解决


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


回复:使用XSL将XML文档中的CDATA注释输出为HTML文本
软件技术

guan1200发表评论于2005/5/26 11:24:45

这个对ie是有用的,求foxfire如何解决??

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

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

 


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

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