推荐:XML在.net平台下的自定义控件的应用(1)Xml全称可扩展标记语言(extensible marked language),这套语言系统由于在数据处理,跨平台等方面的独特优势,在近几年风靡全球。XML语言系统把任何数据都作为“键”和“值&rdq
示例代码
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="http://www.w3.org/1999/xhtml"><![CDATA[<p><imgclass="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"分享:XSL基础教程第五章XSL条件IF XSL可以用一个IF语句过滤来自XML文档的信息。 在哪里放置IF条件 现在来重新看看你已经看过多次的XML文档: 以下为引用的内容: