Copy any other nodes without changing them : copy « XSLT stylesheet « XML

Home
XML
1.CSS Style
2.SVG
3.XML Schema
4.XQuery
5.XSLT stylesheet
XML » XSLT stylesheet » copy 
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>

 
Related examples in the same category
1.xsl:copy
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.