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






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