Skip to content

Instantly share code, notes, and snippets.

@bmix
Forked from emiliano-poggi/identity-variant-1.xsl
Created June 24, 2020 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmix/ee22ca1d957999dcf7091c1621570730 to your computer and use it in GitHub Desktop.
Save bmix/ee22ca1d957999dcf7091c1621570730 to your computer and use it in GitHub Desktop.
XSLT: identity transform
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!--processes all *elements* by copying them, and can be overridden for individual elements -->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- processes all *nodes* by copying them, and can be overridden for individual elements, attributes, comments, processing instructions, or text nodes -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment