-1
我是XSLT新手,我不明白模板的基本概念。 我正在做一個實驗,看看輸出是否是我期望的。不幸的是,這是文件的轉換:爲什麼不輸出標籤的值
的XML:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title>Empire</title>
<artist>Bob Dylan</artist>
<continent>America</continent>
<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>Bulgaria</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
這是XSLT:
<?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:apply-templates select="//continent"/>
</xsl:template>
<xsl:template match="//continent">
<xsl:value-of select="continent"/>
</xsl:template>
</xsl:stylesheet>
輸出是空單。我期望打印出大陸標籤的價值,即America
。請澄清一下這件事情。謝謝tou。