哪买电影票最便宜:帮我看看这个xsl

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 23:56:26
<?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>

两个根?

两个根?
回答者:没有任何借口_ - 经理 五级 5-24 12:38

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>两个根?
回答者:没有任何借口_ - 经理 五级 5-24 12:38

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>