我在XSLT全新的。所以我试图做一个应该输出元素值的例子。输出格式是纯文本格式。 这是XML文件名为cdcatalog.xml:为什么这个代码不输出任何XSLT
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<catalog>
<cd>
<title>Empire</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>
<europe_country>Bulgaria</europe_country>
<azia_coutry>China</azia_coutry>
</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
这是cdcatalog.xsl称为XSL文件
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="cd">
<xsl:value-of select="title"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
我期望的输出是这样的
Empire
Hide your heart
但是输出窗口中没有任何内容。 我错在哪里? 预先感谢您。