I've been looking around for answers for a while but I think it's time to put this to the experts. I'm about spent and need some direction!
I have been trying to create XHTML 1.1 Strict using cgi.pm, and trying to bend it to make it work. I'm starting to question whether I'm heading in the right direction though. For example, to get a header that validates, I have to hack the output (the sub is listed at the end of this post).
The manual says to generate meta http-equiv tags this way, but the output is:
<meta http-equiv="content-language" content="en-gb">
But to validate, we need:
<meta http-equiv="content-language" content="en-gb" />
Also, the script produces a language attribute which is invalid:
<script language="JavaScript" src="/sort.js" type="text/javascript"></script>
I also removed the <?xml... > line to prevent windows quirk mode. There are also other problems such as:
scrolling_list(-name=>'source',-values=>{%list}, -size=>5, -multiple=>'true')
which produces:
<select name="source" size="5" multiple>
but we need:
<select name="source" size="5" multiple="multiple">
to validate. The same is true for selected and checked.
As you can see below, I got around this using s//. But surely there must be a better way?
Is it still the case that the CGI module is not xhtml standards complient or it's still buggy? Are there any better solutions?
Here's my sub:
sub getheader { my $query = new CGI; my $hdr = $query->header(); $_ = $query->start_html( -title=>$_[0], -meta=>{ 'description'=>'Test', 'keywords'=>'test', 'rating'=>'general', 'robots'=>'all' }, -head=>[ meta({ -http_equiv=>'content-language', -content=>'en-gb@' }), meta({ -http_equiv=>'content-type', -content=>'text/html; charset=iso-8859-1@' })], -style=>{ -src=>'/atlantia.css', -media=>'screen', -charset=>'utf-8' }, -dtd=>'-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd', -script=>{ -src=>'/sort.js' }, -onLoad=> defined($_[1]) ? "document.$_[1].focus()" : '', ); #----remove xml prologue <?xml version...> from before doctype to prevent windows 'quirk mode' s/\n//; $_ = $'; #----remove invalid language tag s/language=\"JavaScript\"//; #----replace invalid tag end > with /> for meta http-equiv s/@\">\n/\" \/>\n/g; return $hdr.$_; }
I am running perl v5.6.1 under 5.2.1-RELEASE FreeBSD i386, with cgi version 2.752
In reply to CGI and XHTML by gnewcs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |