gpt4 book ai didi

xslt - xslt 模板可以同时携带 name 和 match 属性吗?

转载 作者:行者123 更新时间:2023-12-04 01:52:36 24 4
gpt4 key购买 nike

以下 (a) 是否允许 (b) 有用

<xsl:template match="foo" name="bar"> 
</xsl:template>

(这意味着模板可以通过递归模板处理或直接从 <xsl:call-template name="bar"/> 触发。

最佳答案

简单地说,是的。我经常命名身份模板并使用 <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>

关于xslt - xslt 模板可以同时携带 name 和 match 属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6478163/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com