Despite the title of your question, you don't seem to be changing the "element text" at all, you are only changing the name.
Define a mapping from old names to new names like this:
Code:
<xsl:key name="renamings" match="root/repeat[1]/*" use="local-name()"/>
And then convert elements like this:
Code:
<xsl:template match="root/repeat[position() > 1]/*">
<xsl:element name="{key('renamings', local-name())}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
And of course you need templates to copy the bits you want to copy and delete the bits you want to delete, but that's all perfectly standard stuff.