【发布时间】:2020-06-17 11:26:33
【问题描述】:
我是 XSLT 的新手,我正在尝试获取我刚刚创建的属性的内容。
我有一些 XML,如下所示:
<subpara id="subpara">
<title>I am some heavy title</title>
<para id="para">Here is some dummy text for a dummy para.</para>
<table id="t01" tocentry="1">
...
在 XSLT 中,我这样做:
<xsl:template match="subpara/title">
<div>
<xsl:attribute name="class">
<xsl:text>title</xsl:text>
<xsl:call-template name="addChangeClasses"/>
</xsl:attribute>
<xsl:attribute name="data-numbering">
<xsl:apply-templates select="parent::*" mode="numbering"/>
</xsl:attribute>
# HERE I'D LIKE TO HAVE THE CONTENT OF THE ATTRIBUTE I JUST CREATED
<xsl:value-of select"@data-numbering"/>
<xsl:apply-templates/>
</div>
</xsl:template>
我的意图是创建该输出:
<div class="title" data-numbering="1.1">1.1 - I am some heavy title</div>
所以我正在创建一个属性数据编号,但我想显示它的内容。
显然,<xsl:value-of select="@data-numbering"/> 是不对的。
有人可以帮助我吗?提前致谢 ! :)
【问题讨论】: