Created
August 10, 2011 20:23
-
-
Save abdelazer/1138129 to your computer and use it in GitHub Desktop.
Transforming Namespaced XHTML with XSLT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" | |
xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:x="http://www.w3.org/1999/xhtml" | |
exclude-result-prefixes="x" | |
version="1.0"> | |
<!-- By default, copy everything unless we have a rule otherwise --> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<!-- Do something with `div` elements in the XHTML namespace --> | |
<xsl:template match="x:div"> | |
<!-- Warning: An XHTML pony is quite powerful --> | |
<pony> | |
<xsl:apply-templates match="@*|node()"/> | |
</pony> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment