question xhtml transitional or strict !?

N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008 00:52:41
GMT Beauregard T. Shagnasty scribed:
Neredbojias said:
Beauregard T. Shagnasty scribed:

Yes, that's what it says, and I think it means the tested page is so
designated. But the _validator page_ is text/html.

Sure. As it should be. It is not a good idea to use
application/xhtml+xml on the web.
Now check "Page Info" (right-click context) in Firefox and see what
content-type is actually rendered (for the validator).

The validator sends as "text/html" as it should. How is that relevant?
You said, "the w3c validator doesn't *accept* the application/xhtml+xml
header." [emphasis mine], which I was rightly disputing.

Here is the php of a page I send to the validator:

<?
header("Vary: Accept");
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
header("Content-Type: application/xhtml+xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "\r\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
echo "\r\n";
} else {
header("Content-Type: text/html; charset=utf-8");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo "\r\n";
}
?>

The $_SERVER["HTTP_ACCEPT"] line determines if the UA can accept
application/xhtml+xml and if it can feeds it a page with a doctype (et
al) for xhtml 1.1; otherwise the doctype becomes that for xhtml 1.0
strict with a Content-Type of text/html. Ergo, this page which works
fine as xhtml 1.1 - application/xhtml+xml in Firefox can only be
validated as xhtml 1.0 - text/html in the w3c validator.

Here is a test page with the exact php as above. You can try it
yourself:

http://www.neredbojias.com/g3test.php

(Do a view-source after validating.)

The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.
 
B

Beauregard T. Shagnasty

Neredbojias said:
The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.

No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008 05:05:57 GMT
Beauregard T. Shagnasty scribed:
No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"

Yes, I get the same thing on any page when I feed the validator straight
headers. But when I feed it the conditional...

<?
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
?>

....it fails. This suggests to me that the validator is able to _check_ any
document for criteria but still not able to accept application/xhtml+xml as
a content type of that document. In other words, it can parse-verify a
non-conditional offering fine without actually accepting the content type
of the document. Whether this is strictly valid or not, I don't know.
 
B

Beauregard T. Shagnasty

Neredbojias said:
Beauregard T. Shagnasty scribed:
No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"

Yes, I get the same thing on any page when I feed the validator straight
headers. But when I feed it the conditional...

<?
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
?>

...it fails.

Me: "Doctor, it hurts when I do this."
Doctor: "Don't do that."

This suggests to me that the validator is able to _check_ any document
for criteria but still not able to accept application/xhtml+xml as a
content type of that document. In other words, it can parse-verify a
non-conditional offering fine without actually accepting the content
type of the document. Whether this is strictly valid or not, I don't
know.

So, in the end, does it matter?
 
M

mynameisnobodyodyssea

So, in the end, does it matter?

Choosing between an HTML and XHTML doctype
maybe can be like flipping a coin,
the important thing is to use valid (X)HTML mark-up and
to have good content etc.
But why set as a general rule to use HTML
and not XHTML if XML is not necessary?
It is a decision that depends on the site.
There are many good sites that use an XHTML doctype.
Browsers recognize XHTML doctype with type/html content type
and IE (at least 6+) deals well with XHTML doctypes
with type/html content type.
Apparently some IE browsers have a problem with XHTML documents
content type text/html starting with a <?xml version="1.0"?> line,
some not.
It might not be pure XML (to accomodate browsers like IE)
but the XHTML doctype and syntax makes a good difference,
it is recognized by browsers
and bots (search engines, validators, etc.)

It is more likely for a site to need in time
to switch from an HTML doctype to an XHTML doctype
than the other way around.
 
A

Adrienne Boswell

Gazing into my crystal ball I observed Neredbojias
Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008
05:05:57 GMT Beauregard T. Shagnasty scribed:
No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"

Yes, I get the same thing on any page when I feed the validator
straight headers. But when I feed it the conditional...

<?
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
?>

...it fails. This suggests to me that the validator is able to
_check_ any document for criteria but still not able to accept
application/xhtml+xml as a content type of that document. In other
words, it can parse-verify a non-conditional offering fine without
actually accepting the content type of the document. Whether this is
strictly valid or not, I don't know.

I'm not sure it's the validator doing that, it _might_ be the host. For
example,
http://www.visionforglendale.com is using the conditional and comes back
fine, while http://ethicsproject.org is also using the conditional and
does not.
 
B

Beauregard T. Shagnasty

<some snippage>
Choosing between an HTML and XHTML doctype
maybe can be like flipping a coin,

Well, that depends. As long as you cheat and serve XHTML as "Content
type: text/html" it will probably work, thanks to browser correction.
It is a decision that depends on the site.

Not really.
There are many good sites that use an XHTML doctype.

Yes, but they cheat.
Browsers recognize XHTML doctype with type/html content type
and IE (at least 6+) deals well with XHTML doctypes
with type/html content type.

Again, that's the cheating. Here is an XHTML page (use IE6):
http://www.fingerlakesbmw.org/test/xhtml.php
Apparently some IE browsers have a problem with XHTML documents
content type text/html starting with a <?xml version="1.0"?> line,
some not.

That is true.
It might not be pure XML (to accomodate browsers like IE)
but the XHTML doctype and syntax makes a good difference,
it is recognized by browsers
and bots (search engines, validators, etc.)

That is irrelevant. Search engines read content, and do not care about
the doctype.
It is more likely for a site to need in time
to switch from an HTML doctype to an XHTML doctype
than the other way around.

Perhaps, but that time is far away. (in a galaxy ...)
 
M

mynameisnobodyodyssea

That is irrelevant. Search engines read content, and do not care about
the doctype.

Search engines extract content from the (X)HTML mark-up,
they know what is the content of the <title> tag,
meta description tag, commented-out text,
anchor text of links, URL of images from the <img> tag, etc.
The syntax specified by the doctype is relevant.
Browsers and bots make an effort to compensate for possible errors
in the (X)HTML source, or for compatibility with previous versions
of browsers (or crawling software in the case of bots).
It is not cheating to use an XHTML doctype in such a way as
to be usable by as many browsers as possible.....
 
M

mynameisnobodyodyssea

Again, that's the cheating. Here is an XHTML page (use IE6):http://www.fingerlakesbmw.org/test/xhtml.php

Your example is an application/xhtml+xml page
and of course IE cannot display it, it displays the source.
IE could display it OK if it would be a text/html document instead.
Why is it cheating to use XHTML doctype with text/html content type
such as to be displayable by IE?
 
B

Beauregard T. Shagnasty

Sorry, me again.
It is interesting that your example has
<meta http-equiv="window-target"

... to prevent people from linking to and displaying the page within a
frame.
while using an XHTML strict doctype (which does not validate
with the target attribute of links).

There is no <a href... target="[something]" > on the page .. which is
what you are apparently speaking to.
 
B

Beauregard T. Shagnasty

On Feb 20, 4:25 pm, "Beauregard" wrote:
[[email protected] wrote:]
(Please do not remove attributes when you snip. Thanks.)
Your example is an application/xhtml+xml page and of course IE cannot
display it, it displays the source.

Of course. It is, after all, a test page to show exactly that.
IE could display it OK if it would be a text/html document instead.
Why is it cheating to use XHTML doctype with text/html content type
such as to be displayable by IE?

Google is my friend:
http://hixie.ch/advocacy/xhtml

Scroll down to the section:

Why using text/html for XHTML is bad
------------------------------------

Beyond this, if you want to send XHTML documents as "text/html", please
feel free to do so. Just be aware of the possible complications. Ok?

That said, why not just use HTML 4.01 Strict, and have your pages work
everywhere? (You don't need to answer that... <g>)
 
M

mynameisnobodyodyssea

....
if you want to send XHTML documents as "text/html", please
feel free to do so. Just be aware of the possible complications. Ok?
That said, why not just use HTML 4.01 Strict, and have your pages work
everywhere? (You don't need to answer that... <g>)

What are the possible complications for XHTML doctype served
as content type text/html?
For example the W3C XHTML 1.0 spec
http://www.w3.org/TR/xhtml1/
is OK in all the browsers I use, I do not know of any complications
for this W3C example.

What I meant about the meta tag for window target in your example
is that it could be accessed from a link in another document
XHTML strict that does not accept the window target attribute in links
(You don't need to answer that...)
 
B

Beauregard T. Shagnasty

What are the possible complications for XHTML doctype served
as content type text/html?

In the previously-mentioned link,
http://hixie.ch/advocacy/xhtml
seek out the sections:

The Myth of "HTML-compatible XHTML 1.0 documents"
-------------------------------------------------

and

Conclusion
----------
For example the W3C XHTML 1.0 spec
http://www.w3.org/TR/xhtml1/
is OK in all the browsers I use, I do not know of any complications
for this W3C example.

Yes, it displays, but as tag soup. It isn't a matter of "what might
work in your browsers today" (and as Jukka is fond of saying, "for some
value of 'work'"), but more a matter of "doing the right thing."
 
J

Jonathan N. Little

Sorry, me again.
It is interesting that your example has
<meta http-equiv="window-target"
while using an XHTML strict doctype (which does not validate
with the target attribute of links).

No it does validate:

http://validator.w3.org/check?verbose=1&uri=http://www.fingerlakesbmw.org/test/xhtml.php
[Valid] Markup Validation of
http://www.fingerlakesbmw.org/test/xhtml.php - W3C Markup Validator


You are confusing the TARGET attribute of an A element which is not
valid in xhtml strict. A meta element ids another issue.

<meta name="bogosity" content="just made up but valid">
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008 14:31:11
GMT Beauregard T. Shagnasty scribed:
Neredbojias said:
Beauregard T. Shagnasty scribed:
Neredbojias wrote:

The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.

No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"

Yes, I get the same thing on any page when I feed the validator
straight headers. But when I feed it the conditional...

<?
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
?>

...it fails.

Me: "Doctor, it hurts when I do this."
Doctor: "Don't do that."

This suggests to me that the validator is able to _check_ any
document for criteria but still not able to accept
application/xhtml+xml as a content type of that document. In other
words, it can parse-verify a non-conditional offering fine without
actually accepting the content type of the document. Whether this is
strictly valid or not, I don't know.

So, in the end, does it matter?

It matters if you use a conditional script. That's what brought my
attention to this; I was getting xhtml 1.0 validation for what was
supposed to be an xhtml 1.1 page.
 
D

dorayme

<[email protected]
m>,
But why set as a general rule to use HTML
and not XHTML if XML is not necessary?

Good question and a similar one has been asked about other things
too along these lines. Why have a simple scientific theory when
you can have a complicated one that does the same thing and no
better in practice. It is all very well to mention William of
Ockham here, but there is the question why we should bow down to
this man's conjecture.
 
M

mynameisnobodyodyssea

Yes, it displays, but as tag soup.

Do you mean you see the W3C XHTML 1.0 spec as the XML source?
It displays OK in all IE browsers I use.
Probably it is the <?xml version="1.0"?> first line.
Are there pages with XHTML doctype
and with content type text/html and
without the <?xml version="1.0"?> first line
that display as 'tag soup' in your browser?

I still think that an XHTML doctype is better.
For example if you want to serve the same page as
content type text/html for IE or Firefox and
as application/xhtml+xml for mobile phones you
can use (for example) an XHTML Basic doctype
and just change the content type in the header
according to the user-agent,
and add the <?xml version="1.0"?> to the
application/xhtml+xml version
(I repeat that it is just a very simplified example).
 
M

mynameisnobodyodyssea

No it does validate:

Exactly, a page with strict doctype and valid (X)HTML mark-up
linking to a page using <meta http-equiv="window-target"
would be a contradiction, because a strict (X)HTML doctype
does not accept the target attribute for links.
My point is simple: things are not that simple in
the world of the world wide web...
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008 15:16:52
GMT Adrienne Boswell scribed:
Gazing into my crystal ball I observed Neredbojias
Well bust mah britches and call me cheeky, on Wed, 20 Feb 2008
05:05:57 GMT Beauregard T. Shagnasty scribed:
Neredbojias wrote:

The results clearly indicate that the validator does _not_ accept
application/xhtml+xml.

No, I think your test may prove that the validator may under some
circumstances not accept XHTML 1.1 as application/xhtml+xml

I added an XHTML 1.1 page at my site.
http://www.fingerlakesbmw.org/test/xhtml11.php
and it appears to validate just fine. <shrug>

"This Page Is Valid XHTML 1.1!"
"Content-Type: application/xhtml+xml"

Yes, I get the same thing on any page when I feed the validator
straight headers. But when I feed it the conditional...

<?
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
?>

...it fails. This suggests to me that the validator is able to
_check_ any document for criteria but still not able to accept
application/xhtml+xml as a content type of that document. In other
words, it can parse-verify a non-conditional offering fine without
actually accepting the content type of the document. Whether this is
strictly valid or not, I don't know.

I'm not sure it's the validator doing that, it _might_ be the host.
For example,
http://www.visionforglendale.com is using the conditional and comes
back fine, while http://ethicsproject.org is also using the
conditional and does not.

I suppose that's possible although I still suspect the validator. Btw,
your first example validates as text/html (xhtml 1.0 strict) while the
second fails validation as html 4.01 transitional. Is that what you
intended?

A way to determine if the host is at fault might be to check the same
page on several different hosts, but, unfortunately, I don't have that
option currently available to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top