-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。