shannon 2002/07/02 16:18:24 Modified: src/documentation/xdocs/faq faq-serializers.xml Log: Added - new FAQ based on cocoon-user thread on removing doctype declaration from serialized files - new FAQ based on Harry Lai's ( [EMAIL PROTECTED] ) method of excluding namespaces by extending a serializer component, edited by me from summary posted by Reinhard Poetz ([EMAIL PROTECTED]) Revision Changes Path 1.4 +63 -0 xml-cocoon2/src/documentation/xdocs/faq/faq-serializers.xml Index: faq-serializers.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/faq/faq-serializers.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- faq-serializers.xml 6 Jun 2002 18:18:38 -0000 1.3 +++ faq-serializers.xml 2 Jul 2002 23:18:24 -0000 1.4 @@ -56,7 +56,70 @@ </answer> +</faq> + +<faq> + <question> +How can I remove the DTD declaration at the top of my HTML +pages created from pipelines with the default (HTML) serializer? + </question> + + <answer> + <p> +Within the map:components section of sitemap.xmap, adjust the configuration of your HTML serializer component as follows. + </p> +<source><![CDATA[ +<map:serializers default="html"> + + <map:serializer name="html" mime-type="text/html; charset=ISO-8859-1" + src="org.apache.cocoon.serialization.HTMLSerializer"> + <encoding>ISO-8859-1</encoding> + <omit-xml-declaration>true</omit-xml-declaration> + </map:serializer> + + <!-- other serializers --> + +</map:serializers> +]]></source> + + <note> +Consider using the XMLSerializer in your pipeline. The XMLSerializer will not write a DocType Declaration. + </note> + +</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 extend your serializer component and override the startPrefixMapping and endPrefixMapping methods to do nothing. This will remove <strong>all</strong> namespaces from the serialized output. Since your serializer will no longer be processing namespaces, this theoretically will improve performance ever so slightly. You could generalize this approach by using the serializer's configuration method to declare namespaces to be excluded. + </p> + <p> +Another approach is to use an interim transformation step in your pipeline with a stylesheet described <link href="faq-xslt.html#faq-5">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]