shannon 2002/07/02 16:16:12 Modified: src/documentation/xdocs/faq faq-xslt.xml Log: Added new FAQ based on Manos Batsis' ([EMAIL PROTECTED]) stylesheet method of removing namespaces, edited by me from summary posted by Reinhard Poetz ([EMAIL PROTECTED]) Revision Changes Path 1.5 +44 -0 xml-cocoon2/src/documentation/xdocs/faq/faq-xslt.xml Index: faq-xslt.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/faq/faq-xslt.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- faq-xslt.xml 19 Jun 2002 20:31:27 -0000 1.4 +++ faq-xslt.xml 2 Jul 2002 23:16:12 -0000 1.5 @@ -93,6 +93,50 @@ </answer> </faq> +<faq> + <question> +How can I remove namespaces from my xml files? + </question> + + <answer> + <p> +Sometimes adding xsl:exclude-result-prefixes attributes +to the <xsl:stylesheet> or literal result element is not effective +in removing all namespace declarations. For example, namespace nodes copied +from the source document within <xsl:copy> or <xsl:copy-of> instructions +(commonly found in catch-all stylesheet templates) will not be excluded. + </p> + <p> +There are two approaches to this problem. + </p> + <p> +One approach is to add a transformation step in your pipeline (or adjust your final stylesheet) with the following: + </p> +<source><![CDATA[ +<?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> +]]></source> + <p> +Another approach is to extend your serializer component, described <link href="faq-serializers.html#faq-4">here</link>. + </p> +</answer> +</faq> </faqs>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]