抽脂价目表:帮我看看这个xsl

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/10 08:02:41
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
that is
<xsl:value-of select="second"/>
</xsl:template>

<xsl:template match="root">
this is
<xsl:value-of select="first"/>
</xsl:template>
</xsl:stylesheet>
root是根元素 first和second是两个子元素 这样写为什么只能出现一个?

root的模板定义了2次,当然只有一个能显示了
改成下面的样子就可以了:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
this is
<xsl:value-of select="first"/>
that is
<xsl:value-of select="second"/>
</xsl:template>
</xsl:stylesheet>