zoukankan      html  css  js  c++  java
  • 用xsl显示html效果

    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="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>


    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>



    关键一句是:
    disable-output-escaping="yes"
  • 相关阅读:
    Windows XP中万能断点
    c#运算符 ?
    转神秘的程序员
    经典解决“线程间操作无效
    文件上传
    dowload.aspx
    mail
    js 正则
    新年快乐
    DataTable Compute
  • 原文地址:https://www.cnblogs.com/goody9807/p/828248.html
Copyright © 2011-2022 走看看