Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xslt模板可以同时携带名称和匹配属性吗?_Xslt - Fatal编程技术网

xslt模板可以同时携带名称和匹配属性吗?

xslt模板可以同时携带名称和匹配属性吗?,xslt,Xslt,以下(a)项允许(b)项有用吗 (这意味着模板可以通过递归模板处理触发,也可以直接从触发。如果xsl:template元素具有name属性,则它也可以(但不必)具有match属性。 简单地说,是的。我经常给标识模板命名,并使用直接调用它 对于某种形式的继承来说,它是一个有用的工具;您可以定义一个模板来匹配一个节点,然后定义另一个模板来处理该节点的派生节点(该节点执行特定操作),然后调用更通用的模板 例如: <xsl:template match="animal" name="anima

以下(a)项允许(b)项有用吗



(这意味着模板可以通过递归模板处理触发,也可以直接从

触发。如果xsl:template元素具有name属性,则它也可以(但不必)具有match属性。
简单地说,是的。我经常给标识模板命名,并使用
直接调用它

对于某种形式的继承来说,它是一个有用的工具;您可以定义一个模板来匹配一个节点,然后定义另一个模板来处理该节点的派生节点(该节点执行特定操作),然后调用更通用的模板

例如:

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

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