Home >Backend Development >XML/RSS Tutorial >Detailed explanation of how to use XSL to display XML data

Detailed explanation of how to use XSL to display XML data

黄舟
黄舟Original
2017-03-29 16:03:102208browse

使用XSL可以给XML文档添加上显示信息。

--------------------------------------------------------------------------------

使用XSL来显示XML文档
XSL是XML的可扩展样式单语言。

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>

The above is the detailed content of Detailed explanation of how to use XSL to display XML data. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn