Ed,

This is my (dirty?) solution to removing prefixes. It is an extra XSL I put into the 
pipeline before I send the result to the HTML serializer. The CASTA\\ Client XML 
Editor I am using returns tags like <XHTML:P>. I replace them with <p xmlns="x...">. 
It recursively works it's way through the complete XML.

If anyone knows a better solution, please let me know.


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns="http://www.w3.org/1999/xhtml"; exclude-result-prefixes="xhtml" 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:src="http://xml.apache.org/xindice/Query"; 
xmlns:res="http://www.hippo.nl/xml/resource"; 
xmlns:collection="http://apache.org/cocoon/xmldb/1.0";  
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
        <xsl:template match="*">
                        <xsl:element name="{local-name()}" 
namespace="{namespace-uri()}">
                                <xsl:for-each select="@*">
                                        <xsl:variable name="attname" 
select="name()"></xsl:variable>
                                        <xsl:attribute name="{$attname}">
                                                <xsl:value-of 
select="."></xsl:value-of>
                                        </xsl:attribute>
                                </xsl:for-each>
                                <xsl:choose>
                                        <xsl:when test="count(./*) != 0">
                                                <xsl:apply-templates>
                                                </xsl:apply-templates>
                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:value-of 
select="."></xsl:value-of>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:element>
        </xsl:template>
</xsl:stylesheet>

Regards,

Arjé Cahn


---------------------------------------------------------
Content Management Department
Hippo Webworks
Grasweg 35
1031 HW Amsterdam
The Netherlands
Tel  +31 (0)20 6345173 
Fax +31 (0)20 6345179
arje(at)hippo(dot)nl / www.hippo.nl



-----Oorspronkelijk bericht-----
Van: Cocoon Newbie [mailto:[EMAIL PROTECTED]]
Verzonden: 17 April 2002 22:34
Aan: Cocoon Users
Onderwerp: Getting rid of namespaces in result


I am trying to get rid of namespaces in my HTML output produced by 
Cocoon2. I searched the web/archives and found "exclude-result-prefixes" 
attribute to xsl:stylesheet element. However, if prior to using this 
attribute only HTML element had prefixes in the result, after using it 
HTML element does not but all its child nodes do. Is there a way to get 
rid of these prefixes short of defining XSLT templates for all possible 
XML elements?

Thanks,

Ed


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to