I have very limited experience with xslt so I can't seem to find the problem here.
In the XML I have multiple occurrences of distinct graphic elements like so:
<graphic xlink:href="someVariableText-gf01.tif"/>
<graphic xlink:href="someVariableText-gf02.tif"/>
<graphic xlink:href="someVariableText-gf03.tif"/>
I need to change the xlink:href preserving the unique numbers after -gf.
My code below:
<xsl:template match="graphic/@xlink:href">
<xsl:variable name="aftergf" select="substring-after(., 'gf')"/>
<xsl:attribute name="xlink:href">
<xsl:value-of select="concat('MyNewText-gf', $aftergf)"/>
</xsl:attribute>
</xsl:template>
Gives me:
<graphic xlink:href="MyNewText-gf"/>
<graphic xlink:href="MyNewText-gf"/>
<graphic xlink:href="MyNewText-gf"/>
What am I doing wrong?
No comments:
Post a Comment