Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Add new parent tag

File: Data.xml <customer>   <last>Hill</last>   <first>Phil</first>   <phone>212-555-1212</phone>   <address>166 Main St.</address>   <city>New York</city>   <state>NY</state>   <zip>10001</zip> </customer> 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="customer">     <client>       <xsl:apply-templates />     </client>   </xsl:template>    </xsl:stylesheet> Output: <client>   Hill   Phil   212-555-1212   166 Main St.   New York   NY   10001 </client>