Using xsl:element and xsl:attribute to create xml tags
File: Data.xml <?xml version = "1.0" encoding = "UTF-8"?> <sports> <game title = "cricket"> <id>243</id> <paragraph> para 1 </paragraph> </game> </sports> File: Transform.xslt <?xml version = "1.0" encoding = "UTF-8"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <!-- match sports elements --> <xsl:template match = "/sports"> <sports> <xsl:apply-templates select = "game"/> </sports> </xsl:template> <!-- match game elements --> <xsl:template match = "game"> <!-- create child element --> <xsl:element name = "{@title}"> <!-- create attribute --> <xsl:attribute name = "id"> <xsl:value-of select = "id"/> </xsl:attribute> <comment> <xsl:value-of select = "paragraph"/> </comment> </xsl:element> </xsl:template> </xsl:stylesheet> Output: <?xml version="1.0" encoding="UTF-8"?><sports><cricket id="243"><comment> para 1 </comment></cricket></sports>