Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 69916 invoked from network); 5 Aug 2005 11:50:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2005 11:50:23 -0000 Received: (qmail 68915 invoked by uid 500); 5 Aug 2005 11:50:20 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 68850 invoked by uid 500); 5 Aug 2005 11:50:20 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 68836 invoked by uid 99); 5 Aug 2005 11:50:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2005 04:50:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ap-cocoon-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2005 04:50:09 -0700 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1E10gu-0001uh-Ib for dev@cocoon.apache.org; Fri, 05 Aug 2005 13:48:44 +0200 Received: from lns-vlq-41-str-82-252-43-126.adsl.proxad.net ([82.252.43.126]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Aug 2005 13:48:44 +0200 Received: from eric.burghard by lns-vlq-41-str-82-252-43-126.adsl.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Aug 2005 13:48:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: dev@cocoon.apache.org From: BURGHARD =?ISO-8859-15?Q?=C9ric?= Subject: Re: Suggestion for XHTMLSerializer Date: Fri, 05 Aug 2005 13:49:53 +0200 Lines: 82 Message-ID: References: <1123067609.7378.9.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: lns-vlq-41-str-82-252-43-126.adsl.proxad.net User-Agent: KNode/0.9.1 Sender: news X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Thorsten Scherler wrote: > On Tue, 2005-08-02 at 11:25 +0200, Antonio Fiol Bonn�n wrote: >> Hello, >> >> I am finding a problem with empty elements when serving content with >> the text/html content type on Firefox. > >> For example, collapsed empty div elements cause havoc in firefox. A >> possible workaround would be implementing the compatibility guidelines >> indicated in the W3C recommendations. >> >> In particular, I would add the same check already present for style, >> script and textarea for any element whose end tag is required in HTML >> 4.01. >> > I found a simple solution to this problem. In fact the XMLSerializer didn't take the 'method' parameter into account. At least in saxon8 (never test with other xslt processor, but it should work too), if you put all tags like div, script, or inputarea remains unclosed. I think this is a bug with XMLSerializer which enforce the method to be 'xml'. The folowing simple class let you choose the serialization method. public class XMLSerializer2 extends AbstractTextSerializer { /** * Set the configurations for this serializer. */ public void configure(Configuration conf) throws ConfigurationException { super.configure( conf ); } /** * Set the {@link OutputStream} where the requested resource should * be serialized. */ public void setOutputStream(OutputStream out) throws IOException { super.setOutputStream(out); try { TransformerHandler handler = this.getTransformerHandler(); handler.getTransformer().setOutputProperties(this.format); handler.setResult(new StreamResult(this.output)); this.setContentHandler(handler); this.setLexicalHandler(handler); } catch (Exception e) { final String message = "Cannot set XMLSerializer outputstream"; throw new CascadingIOException(message, e); } } } Now just configure this serializer in sitemap.xmap like you do with regular XMLSerializer. -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd UTF-8 yes xhtml net.sf.saxon.TransformerFactoryImpl I wrote a much more powerfull solution: the XSLSerializer, which let you control the serialization through an xsl stylesheet (an so use the xsl:output tag as well as some template rules to make final cleanup like namespace deletion or href contextualization). I need to do some cleanup, and i will submit a patch. Regards