以下(a)是否允许(b)有用
<xsl:template match="foo" name="bar">
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
(这意味着可以通过递归模板处理或直接从模板触发模板 <xsl:call-template name="bar"/>
Fly*_*179 17
简单地说,是的.我经常命名身份模板并使用a直接调用它<xsl:call-template name="identity" />.
它是一种有用的继承形式的工具; 您可以定义一个模板以匹配一个节点,另一个模块处理该节点的衍生物,然后调用更通用的模板.
例如:
<xsl:template match="animal" name="animal">
<!-- handle any animal related stuff here -->
</xsl:template>
<xsl:template match="dog">
<xsl:call-template name="animal" />
<!-- handle any dog specific stuff here -->
</xsl:template>
Run Code Online (Sandbox Code Playgroud)