When my XSL stylesheets encounters this node:
<node attribute="3"/>
…it should transform it into this node:
<node attribute="***"/>
My template matches the attribute and recreates it, but I don’t know how to set the value to: the character ‘*’ repeated as many times as the value of the original attribute.
<xsl:template match="node/@attribute">
<xsl:variable name="repeat" select="."/>
<xsl:attribute name="attribute">
<!-- What goes here? I think I can do something with $repeat... -->
</xsl:attribute>
</xsl:template>
Thanks!
A fairly dirty but pragmatic approach would be to make a call on what’s the highest number you ever expect to see in
attribute, then usewhere you have as many
*s in that string as that maximum number you expect. But I hope that there’s something better!