Subject: Removing namespaces without escaping CDATA???
From: ypomonh@xxxxxxxxxxx
Date: Fri, 6 Apr 2007 11:27:56 +0300
|
I' trying to remove namespaces from a document using the following piece of code that although works, has the side-effect of escaping CDATA sections (eg. "<![CDATA[blah blah]]>").
How can I prevent CDATA from being escaped..?
--- Begin xsl ---
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="*">
<!-- remove element prefix (if any) -->
<xsl:element name="{local-name()}">
<!-- process attributes -->
<xsl:for-each select="@*">
<!-- remove attribute prefix (if any) -->
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
--- End xsl ---
|