您现在的位置是:网站首页> 编程资料编程资料

使用XSL将XML文档中的CDATA注释输出为HTML文本_XML示例_

2023-05-25 361人已围观

简介 使用XSL将XML文档中的CDATA注释输出为HTML文本_XML示例_

示例代码
1.   test.xml
复制代码 代码如下:




 entry with images
 August 09, 2003
 Kevin
 000033
 http://alazanto.org/xml/archives/000033.xml
   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.
  

]]>
 
 
 http://alazanto.org/xml/archives/000033_comments.xml
 6


2.  test.xsl
复制代码 代码如下:

 

 
 
 
 
 
 
 

 
 
 



关键之外在于使用的命名空间xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 和输出时加上disable-output-escaping="yes"

-六神源码网