For the same problem I'm using this pure XSL solution
<xsl:template match="*" priority="-1" mode="copy">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:element>
</xsl:template>
<xsl:template match="text()" mode="copy">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
The weight on performance could be balanced by finer handling of nodes.
----- Original Message -----
From: "Lai, Harry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 4:54 PM
Subject: RE: How to remove namespace declarations and prefixes?
> Hi Richard,
>
> I also had this same problem. I did some reading, and according to
Michael
> Kay's XSLT Programmer's Reference:
>
> "The xsl:exclude-result-prefixes and exclude-result-prefixes attributes
> apply only to namespace nodes copied from the stylesheet using literal
> result elements. They do not affect namespace nodes copied from the
source
> document using <xsl:copy> or <xsl:copy-of>: there is no way of suppressing
> these."
>
> Unfortunately, since xslt's will often have a catch-all template matcher
to
> copy elements it doesn't transform, this comes up quite a bit.
>
> So... what I ended up doing was extending the HTMLSerializer (or whatever
> serializer you're using for your pipelines), and overriding the
> startPrefixMapping and endPrefixMapping methods to do nothing, effectively
> removing all namespaces from my HTML. This also had the added benefit of
> having no performance penalties (and theoretically, a ever-so-slight
speedup
> since we no longer process namespaces in our serializer).
>
> You could make this more general, and use the serializer's configuration
to
> declare which namespaces you want to exclude, but excluding all worked
well
> for us, especially since we were outputting HTML.
>
> Hope that helps!
>
> Harry
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>