Hi,
I have some problems removing the xmlns attributes from a transformed xml file. I can't completely remove them (so it would validate).
the problematic elements are <div> or the elements pasted by <xsl:copy-of>
if I have no default NS in the XSL file I get the namespace attribute attached to the copied elements (the one from the "plan" prefix because that's default NS of the XML, all prefixed NS are removed).
if I have a default NS in the XSL file, the copied elements are free of NS, but the NS is now attached to the <div> element (because it's the top level element in the result XML).
so, how do I need to change my copy construct to get all elements without NS?
alternatively I have to add a preg_replace() function to my script, if this is not possible with XSL......
the xsl file (the important part):
I have some problems removing the xmlns attributes from a transformed xml file. I can't completely remove them (so it would validate).
the problematic elements are <div> or the elements pasted by <xsl:copy-of>
if I have no default NS in the XSL file I get the namespace attribute attached to the copied elements (the one from the "plan" prefix because that's default NS of the XML, all prefixed NS are removed).
if I have a default NS in the XSL file, the copied elements are free of NS, but the NS is now attached to the <div> element (because it's the top level element in the result XML).
so, how do I need to change my copy construct to get all elements without NS?
alternatively I have to add a preg_replace() function to my script, if this is not possible with XSL......
the xsl file (the important part):
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:plan="urn:kbl.plan:current-and-bygone-playlists" // default NS of the XML file
exclude-result-prefixes="xsl plan">
[...]
<xsl:template match="/">
<xsl:element name="div"> // either I have xmlns="..." here ...
<xsl:attribute name="class">
<xsl:text>mitte inhalt</xsl:text>
</xsl:attribute>
[...]
<xsl:for-each select="$basis/child::plan:thema">
<xsl:call-template name="themen" />
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template name="themen">
<xsl:call-template name="balken" />
<xsl:for-each select="plan:termin">
<xsl:call-template name="termine" />
</xsl:for-each>
<xsl:if test="plan:xhtml">
<xsl:copy-of select="plan:xhtml/*" /> // ... or here
</xsl:if>
</xsl:template>
Comment