Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

Restructure xml

File: Data.xml <name>   <last>A</last>   <first>B</first> </name> File: Transform.xslt <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:output method="xml" indent="yes" />   <xsl:output omit-xml-declaration="yes" />   <xsl:template match="name">     <name>       <family>         <xsl:apply-templates select="last" />       </family>       <given>         <xsl:apply-templates select="first" />       </given>     </name>   </xsl:template> </xsl:stylesheet> Output: <name>    <family>A</family>    <given>B</given> </name>