Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Copy any other nodes without changing them

File: Data.xml <customer>   <lastName>A</lastName>   <firstName>B</firstName>   <phone>212-555-1212</phone> </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" />      <xsl:template match="@*|node()">     <xsl:copy>       <xsl:apply-templates select="@*|node()" />     </xsl:copy>   </xsl:template> </xsl:stylesheet> Output: <customer>   <lastName>A</lastName>   <firstName>B</firstName>   <phone>212-555-1212</phone> </customer>