Of course, I was missing the square brackets!

After a key value the cgi object expects a closing parens or a comma followed by further key/value pairs. To supply more than one value to a key we require to place multiple values inside an anonymous array, hence placing them inside square brackets. Unless we do this only the first value will be parsed dropping all subsequent values until the next key is reached.

The importance of the dtd uri is not strictly a perl question granted, however in my assumptions the dtd key would take say '4.01 strict' as a value and proceed to produce the relevant uri namespace. Which would make this more of a cpan query. In the end I was supplying the values incorrectly, so it was a perl question. phew. Reasons for not implementing this behaviour would I expect start with - developer wishes to supply their own dtd.

As for the browser behaviours MidLifeXis and ww have hit the nail on the head. I'm using IE6. I am developing a website that has marketing towards the national health service (nhs) staff in the uk. This organisation infamously still use ie6 on their workstations. Ie6 is a lot happier when supplied with the correct dtd's.

But, having corrected the syntax there is still the issue of the xhtml namespace appearing. I think the xhtml namespace is partnered to the xml dtd as the html strict 4 url is partnered to the html 4 strict dtd. Even if the namespace is disabled by supplying the html4 values correctly, unless -no_xhtml is given as an argument to the CGI import, the xmlns namespace line appears in the html header alongside the html4 outputs so we get xmlns:lang='en-GB' and lang='en-GB' attributes inside the html element. Which to me suggests that -no_xhtml must be used when declaring html4 dtd's as it is the solution to the problem or have I found a bug in CGI.pm that needs reporting, go on surely I have(?)!

use CGI qw/:html4/; print $q->start_html(-lang=>'en-GB', dtd=>['-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/ +html4/strict.dtd']);

becomes

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-G +B">

and

use CGI qw/:html4 -no_xhtml/; print $q->start_html(-lang=>'en-GB', dtd=>['-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/ +html4/strict.dtd']);

becomes

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-GB">

In reality I think my next step would be to inspect CGI.pm source and see if I can figure out what is going on. however ie6 has several idiosyncracies that I need to contemplate first :(

many thanks for the perlsyn nudge

Don Coyote


In reply to Re^3: cgi.pm -import strict html4 address into html4 strict dtd header by Don Coyote
in thread cgi.pm -import strict html4 address into html4 strict dtd header by Don Coyote

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.