XML的XSL转换
XSL是XML文档的样式表语言。它可以把XML文档中的数据以不同的结构或格式转换为另一文档。
book.xml
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTBook.xslt"?>
<books>
<book>
<author>Lucy</author>
<price>30</price>
<pubdate>05/08/2000</pubdate>
<publisher>清华大学出版社</publisher>
</book>
<book>
<author>Lily</author>
<price>40</price>
<pubdate>06/09/2001</pubdate>
<publisher>北京大学出版社</publisher>
</book>
<book>
<author>Jim</author>
<price>50</price>
<pubdate>07/10/2002</pubdate>
<publisher>南京大学出版社</publisher>
</book>
<book>
<author>Bruce</author>
<price>60</price>
<pubdate>08/11/2003</pubdate>
<publisher>上海大学出版社</publisher>
</book>
</books>
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTBook.xslt"?>
<books>
<book>
<author>Lucy</author>
<price>30</price>
<pubdate>05/08/2000</pubdate>
<publisher>清华大学出版社</publisher>
</book>
<book>
<author>Lily</author>
<price>40</price>
<pubdate>06/09/2001</pubdate>
<publisher>北京大学出版社</publisher>
</book>
<book>
<author>Jim</author>
<price>50</price>
<pubdate>07/10/2002</pubdate>
<publisher>南京大学出版社</publisher>
</book>
<book>
<author>Bruce</author>
<price>60</price>
<pubdate>08/11/2003</pubdate>
<publisher>上海大学出版社</publisher>
</book>
</books>
XSLTBook.xslt
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTBook.xslt"?>
<books>
<book>
<author>Lucy</author>
<price>30</price>
<pubdate>05/08/2000</pubdate>
<publisher>清华大学出版社</publisher>
</book>
<book>
<author>Lily</author>
<price>40</price>
<pubdate>06/09/2001</pubdate>
<publisher>北京大学出版社</publisher>
</book>
<book>
<author>Jim</author>
<price>50</price>
<pubdate>07/10/2002</pubdate>
<publisher>南京大学出版社</publisher>
</book>
<book>
<author>Bruce</author>
<price>60</price>
<pubdate>08/11/2003</pubdate>
<publisher>上海大学出版社</publisher>
</book>
</books>
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="XSLTBook.xslt"?>
<books>
<book>
<author>Lucy</author>
<price>30</price>
<pubdate>05/08/2000</pubdate>
<publisher>清华大学出版社</publisher>
</book>
<book>
<author>Lily</author>
<price>40</price>
<pubdate>06/09/2001</pubdate>
<publisher>北京大学出版社</publisher>
</book>
<book>
<author>Jim</author>
<price>50</price>
<pubdate>07/10/2002</pubdate>
<publisher>南京大学出版社</publisher>
</book>
<book>
<author>Bruce</author>
<price>60</price>
<pubdate>08/11/2003</pubdate>
<publisher>上海大学出版社</publisher>
</book>
</books>