You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Legg <da...@searchevent.co.uk> on 2005/11/09 17:39:10 UTC

How do you generate 4.01 strict HTML?

I've been reading a lot about the pros and cons of generating XHTML web 
pages.  I've come to the conclusion that any browser except perhaps Firefox 
and Opera should really be using HTML 4.01 strict (especially if they are 
planning on using AJAX any time soon).

[Interested parties should read http://www.hixie.ch/advocacy/xhtml for the 
details]

Anyhow... I thought this would be a simple exercise in Cocoon.  All you have 
to do is update the html serializer settings in the sitemap to generate the 
appropriate DOCTYPE statement and off you go.

Mmm... I can't validate the resulting web page because the html tag contains 
xmlns="http://www.w3.org/1999/xhtml".

The other problem is my XSLT stylesheet has to contain <link .... /> 
statements as you might expect but shouldn't the serializer remove the '/' 
character and turn these into <link ... > tags?

Anyone know the secret to generating compliant 4.01 strict from Cocoon?

Regards,
David Legg



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How do you generate 4.01 strict HTML? - SOLVED

Posted by David Legg <da...@searchevent.co.uk>.
> Anyone know the secret to generating compliant 4.01 strict from Cocoon?

OK... I solved my own problem.  So, for the record...

My xslt transformation file (which originated from the Cocoon welcome.xslt 
file) had the following line near the top: -

    <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns="http://www.w3.org/1999/xhtml">

That default namespace declaration on the end of the line was interfering 
with the HTML serializer and preventing it from generating true HTML.  I 
removed it and changed the 'html' serializer declaration in the sitemap 
to: -

    <map:serializer logger="sitemap.serializer.html"
         mime-type="text/html"
         name="html"
         src="org.apache.cocoon.serialization.HTMLSerializer">
      <doctype-public>-//W3C//DTD HTML 4.01//EN</doctype-public>
      <doctype-system>http://www.w3.org/TR/html4/strict.dtd</doctype-system>
    </map:serializer>

Now the page is correctly being output as strict HTML 4.01 with no 
namespaces or '/' characters in <br> tags for example.

Regards,
David Legg 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org