Restructure xml document
File: Data.xml <wine grape="Chardonnay"> <product>product 2</product> <year>1997</year> <price>10.99</price> </wine> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="no" /> <xsl:template match="wine"> <wine vintage="{year}"> <product> <xsl:apply-templates select="product" /> </product> <category> <xsl:value-of select="@grape" /> </category> <price> <xsl:apply-templates select="price" /> </price> </wine> </xsl:template> </xsl:stylesheet> Output: <wine vintage="1997"><product>product 2</product><category>Chardonnay</category><price>10.99</price></wine>