Hey I have a scenario where I have a xml structure like
<deftms>
<tn>abc</tn>
<td>xyz</td>
<tn>abc1</tn>
<td>xyz1</td>
<tn>abc2</tn>
<td>xyz2</td>
</deftms>
want to convert it as :
<deftms>
<newtms>
<tn>abc</tn>
<td>xyz</td>
</newtms>
<newtms>
<tn>abc1</tn>
<td>xyz1</td>
</newtms>
<newtms>
<tn>abc2</tn>
<td>xyz2</td>
</newtms>
</deftms>
am using following transform xsl code to achieve the output
<xsl:template name = "deftms">
<deftms>
<xsl:for-each select="//deftms/tn">
<xsl:variable name="tn"><xsl:value-of select="current()" /></xsl:variable>
<xsl:variable name="td"><xsl:value-of select="(current())" /></xsl:variable>
<newtms>
<tn><xsl:copy-of select="$tn" /></tn>
<td><xsl:copy-of select="$td" /></td>
</newtms>
</xsl:for-each>
</deftms>
</xsl:template>
Anyone any idea ?
Try: