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 |