Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Copy the result of apply-templates

File: Data.xml <colors>   <color>     red:     <shade>A</shade>     <shade>B</shade>     <shade>C</shade>   </color>   <color>yellow</color>   <color>     blue:     <shade>F</shade>     <shade>G</shade>     <shade>H</shade>   </color> </colors> 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="yes" />   <xsl:template match="@*|node()">     <xsl:copy>       <xsl:apply-templates select="@*|node()" />     </xsl:copy>   </xsl:template> </xsl:stylesheet> Output: <colors>     <color>     red:     <shade>A</shade>         <shade>B</shade>         <shade>C</shade>     </color>     <color>yellow</color>     <color>     blue:     <shade>F</shade>         <shade>G</shade>         <shade>H</shade>     </color> </colors>