I want to Get node position as attribute of a element. I means I want to get id
value like Aut-01
,Aut-02
inside context
element. I mentioned below Input, output and tried code. I am using XSLT 2.0
Input :
<con-group>
<con c-type="aut">
<name>
<fname>Kent-Dennis</fname>
</name>
</con>
<con c-type="aut">
<name>
<fname>dfr-gvfrt</fname>
</name>
</con>
<con c-type="aut">
<con-id con-id-type="ABC11"
>https://wasq.lk/0000-0002-8551-9535</con-id>
<name>
<fname>Glazier</fname>
</name>
</con>
<con c-type="aut">
<con-id con-id-type="ABC12"
>https://wasq.lk/0000-0002-8551-8535</con-id>
<name>
<fname>Glazier</fname>
</name>
</con>
</con-group>
Output should be :
<link ref="https://orcid.org/0000-0002-8551-9535">
<context type="Aut" id="Aut-01">
<image ref="../../../../command/Templates/Template Art/Auth_.jpg"/>
</context><s/>
<link>
<link ref="https://orcid.org/0000-0002-8551-9535">
<context type="Aut" id="Aut-02">
<image ref="../../../../command/Templates/Template Art/Auth_.jpg"/>
</context><s/>
<link>
Tried code :
<xsl:template match="con-id">
<xsl:text> </xsl:text>
<link ref="{.}">
<xsl:variable name="aaa" select="count(self::con-id/preceding-sibling::*)+1"/>
<context type="Aut" id="{$aaa}">
<image ref="../../../../command/Templates/Template Art/Auth_.jpg"/>
<context><s/>
</link>
</xsl:template>
Help me to solve this. I am getting Id value always 1
. As my code I don't get output that I want.