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

示例代码
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-600"
  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"

以上就是使用XSL将XML文档中的CDATA注释输出为HTML文本的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » XML/RSS