最佳答案 是的,这是可能的。您可以将变量作为名称值传递。 -6ren">
gpt4 book ai didi

xslt - 如何动态命名属性?

转载 作者:行者123 更新时间:2023-12-02 11:41:35 25 4
gpt4 key购买 nike

我正在寻找从 xsl 获取 anchor 标记的自定义属性。

是否可以从 xml 动态获取属性名称?

这是我尝试过的:

<xsl:attribute name="<xsl:value-of select="id"/>">
<xsl:value-of select="value"/>
</xsl:attribute>

最佳答案

是的,这是可能的。您可以将变量作为名称值传递。

<xsl:variable name="attributeName" select="id"/>
<xsl:attribute name="{$attributeName}">
<xsl:value-of select="value"/>
</xsl:attribute>

关于xslt - 如何动态命名属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28631506/

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