XSLT 应用模板的默认选择是什么? [英] What is the default select of XSLT apply-templates?

查看:20
本文介绍了XSLT 应用模板的默认选择是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

身份模板如下所示:

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
</xsl:template>

是否比 选择更多>,或者身份模板可能是这样的?

Does <xsl:apply-templates select="@*|node()" /> select more than <xsl:apply-templates />, or could the identity template have been like this?

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates />
    </xsl:copy>
</xsl:template>

当我执行以下操作时,究竟选择了什么?

What exactly is selected when I do the following?

<xsl:apply-templates />

推荐答案

是否选择多个,或者身份模板是否已经被像这样吗?

Does <xsl:apply-templates select="@*|node()" /> select more than <xsl:apply-templates />, or could the identity template have been like this?

<xsl:apply-templates/> 

相当于:

<xsl:apply-templates select="node()"/>

这是一个更短的前:

<xsl:apply-templates select="child::node()"/>

这相当于:

<xsl:apply-templates select="* | text() | comment() | processing-instruction()"/>

正如我们从最后一条指令中看到的,您所询问的 xsl:apply-templates 指令没有选择任何属性,因此它不能用作以下内容的简写:

As we see from the last instruction, the xsl:apply-templates instruction you are asking about, doesn't select any attributes, therefore it cannot be used as a shorthand for:

<xsl:apply-templates select="@*|node()"/>

这篇关于XSLT 应用模板的默认选择是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆