Reputation: 19812
I have an xml file with multiple nodes:
<member>
<screen_name>User</screen_name>
<username>username</username>
</member>
What I want tis to find an replace User with User1,User2,User(n) and username with username1,username2, username(n)
Is that possible?
Upvotes: 1
Views: 294
Reputation: 338158
Apply this XSL template to your XML files (there are several command line tools that can do this)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="screen_name/text() | username/text()">
<xsl:value-of select="concat(., count(preceding::member) + 1)" />
</xsl:template>
</xsl:stylesheet>
Upvotes: 3