Skip to content

Instantly share code, notes, and snippets.

@idac73
Last active December 11, 2015 13:38
Show Gist options
  • Save idac73/4608681 to your computer and use it in GitHub Desktop.
Save idac73/4608681 to your computer and use it in GitHub Desktop.
XSL - two techniques for making XML available for transformation
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xslt="http://xml.apache.org/xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="UTF-8" xslt:indent-amount="2" />
<!-- Technique #1 -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Technique #2 -->
<xsl:template match="*|@*" >
<xsl:copy>
<xsl:apply-templates select="*|text ()|@*" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment