模板匹配问题:当有多个时是怎样进行匹配的?
大可山人 博客专家认证 2004-02-16 04:58:21 <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<!--A处--> <xsl:apply-templates />
</xsl:template>
<!--B处-->
<xsl:template match="/Tree">
<!--B1处--> <xsl:apply-templates/>
</xsl:template>
<!--C处-->
<xsl:template match="TreeNode">
....
</xsl:template>
<!--D处-->
<xsl:template match="TreeNode[* or @NodeXmlSrc]">
<div class="clsItem" type="parent">
<div class="hide" type="container">
<!--D1处--> <xsl:apply-templates />
</div>
</div>
</xsl:template>
<!--E处-->
<xsl:template match="@Target">
<xsl:copy><xsl:value-of /></xsl:copy>
</xsl:template>
<!--F处-->
<xsl:template match="/TreeNode">
<!--F1处--> <xsl:apply-templates/>
</xsl:template>
<!--G处-->
<xsl:template match="TreeNode/Tree">
<!--G1处--> <xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
以上代码是不是下一处的匹配结果直接插入上一个<xsl:apply-templates/>处呢?
例如G处插入到F1处,F处插入到D1处.....最后B处插入到A处?
还是:有N个<xsl:apply-templates/>就有对应的N个<xsl:template...>分别一一对应匹配?即第一个<xsl:template...>插入第一个<xsl:apply-templates/>,第二个<xsl:template...>插入第二个<xsl:apply-templates/>等等类推呢?