input.xml:
<comp>
<link id="#c1-tbl-0001"/>
</comp>
output.xml:
<comp>
<link newid="#c1-tbl-0001"/><tableno>1.1</tableno>
</comp>
i need the value for tableno from attribute value like 1 from tb1 and another 1 from 0001. so the ouput should be 1.1
i used the following xsl but it’s not gives the exact result.
<xsl:element name ="tableno">
<xsl:value-of select ="substring(@id,7)"/>.<xsl:value-of select="substring(@id,12)"/>
</xsl:element>
First of all, the attribute you want to read is named
id, nothref. (Edit: You seem to have corrected this.)You have to give a length to the first
substringcall, so that it only captures one digit:If the second number may use more than one of the digits, but you want to strip the zeros, you can do