Skip to content

Instantly share code, notes, and snippets.

@yamanyar
Created June 12, 2012 07:57
Show Gist options
  • Save yamanyar/2915997 to your computer and use it in GitHub Desktop.
Save yamanyar/2915997 to your computer and use it in GitHub Desktop.
Use scoped default namespaces
<?xml version='1.0'?>
<!-- Kaan Yamanyar, 6/10/2012 -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:alfa="http://test1.com"
xmlns:beta="http://yesy2.com"
exclude-result-prefixes="alfa beta"
version="2.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="alfa:* | beta:*">
<xsl:element name="{local-name()}" namespace="{namespace-uri(.)}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment