XML入门指南(9)使用XSL来显示XML数据

来源:互联网 发布:颜值高却 知乎 编辑:程序博客网 时间:2024/05/21 07:59
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
使用XSL可以给XML文档添加上显示信息。


使用XSL来显示XML文档

XSLXML的可扩展样式单语言。

XSL (全称是:可扩展的样式单语言,the eXtensible Stylesheet Language)比CSS样式单功能要强大的多。XSL的一个主要的用途就是将XML文档转换成HTML格式的文件,然后再交付给浏览器,由浏览器显示转换的结果:

如果你有网景6或者IE 5(或者更高的版本),你可以观看the XML file and the XSL style sheet.

在IE6中的显示结果:View the result in IE 6

在IE5中的显示结果:View the result in IE 5

注意下面的代码片断中的第二行:

<?XML version="1.0" encoding="ISO-8859-1"?> <?XML-stylesheet type="text/XSL" href="simple.XSL"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description> two of our famous Belgian Waffles </description> <calories>650</calories> </food> </breakfast_menu>

如果你想了解更多关于XSL的知识,请阅读我们的XSL 指南。

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击