...

View Full Version : choose which dtd?



Tails
04-05-2003, 08:47 PM
I just learned the html dtd (from a template because no one will remember such a thing) but I want to know what the xhtml one is. Also, what is the strict, transitional, and all that? Does it apply to how strict the errors jump on you? I'm strict on it enough as it is, so I see no errors jumping up either way...except that the validator.w3.org wants a dtd. So which do I choose (I don't use frames, and cgi) and what is a page with a working example? I've never seen an xhtml page on the net.

liorean
04-05-2003, 09:37 PM
Hmm, what DTD to chose is depending on what features you want. As with html, if you want iframes, use loose. Use loose if you want to use name attribute on anything other than form elements.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb">

That's the strict doctype. You might be more interested in transitional or frameset.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">



Well, what to think of:
- Never forget to close an empty tag. <br> --> <br />
- Never shorten anything: <script defer> --> <script defer="defer">
- Never use & in a xhtml document unless it's the beginning of an entity. This includes attribute values such as href on a tags, and embedded information such as scripts or stylesheets. You can only use them in nonparsed sections, iow in CDATA blocks or comments.
- Because of this, it might be a good idea to always use external stylesheets and scripts instead of embedded.
- Use <?xml-stylesheet?> instead of <link> tag for including stylesheets. Or, do a combination. An <?xml-stylesheet?> can point to any element that has an id attribute using the normal #id syntax.
- Remember that parsers are allowed to discard comments without even sending them to eventual content parsers. This means if you use embedded stylesheets or scripts, you shouldn't wrap them in comments.

- Most XML parsers doesn't support script tags. Not even that many of those with knowledge of the xhtml namespace does. Mozilla and probably Safari/Konqueror are the only ones I know of. This is because there's no standard way of including a script to be parsed in the xml standards. Possible ways in the future are to use either PIs, event/action/behavior connected stylesheets, or xlink/hlink.

- Don't rely on state-of-the-art features specs. Xinclude, Xpointer, Xlink are relatively new, and only the oldest xml standards are present and relatively bugfree across many implementations. (XML, XSLT and not much else.)

Tails
04-05-2003, 09:42 PM
I've been really good about the tag stuff. Although this is the first time I've seen the stylesheet expressed not as LINK. I've gotten in the habbit of lowercase tags. So is strict the best one if I want to learn the language to its fullest? Sort of like an advanced challlenging difficulty level?

liorean
04-05-2003, 09:45 PM
Well, it's really unpermissive, so you're forced to do right, from the start. That's a good way to learn how to do it right. It still can't check that you use the tags for their real purpose, though.

pardicity3
04-10-2003, 04:09 AM
<?xml version="1.0" encoding="utf-8"?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb">


What exactly do those two lines mean. I have used them in the past because I was once told to do so...are they just turning my page into an xml document?

liorean
04-10-2003, 07:04 AM
<?xml version="1.0" encoding="utf-8"?>

This line - called the XML declaration, tells the XML parser what version of XML is used, what encoding is used, whether a DTD will be present or not, (standalone attribute, not present here since it defaults to false).

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb">

This line tells the xml parser what default namespace is to be used (xhtml1, in case), and what human language the document is written in.

cg9com
04-24-2003, 06:08 AM
I would stay away from using the XML declaration for now in an HTML document, its not really needed as 1.0 is the only version(right?) and the encoding can be specified in a meta element.
Not to mention it makes IE "quirky". ;)

liorean
04-24-2003, 12:07 PM
I see no reason to let ie hinder me - I'm considering dropping support for that browser until it's on par with a minimum of op6 for CSS, moz for DOM and XML, and iCab for HTML.

brothercake
04-24-2003, 02:38 PM
Originally posted by liorean
I see no reason to let ie hinder me - I'm considering dropping support for that browser until it's on par with a minimum of op6 for CSS, moz for DOM and XML, and iCab for HTML.
You don't have a living to make then? :rolleyes: ;)

I don't think dropping support for IE is practical, however desirable. I also exclude the xml declaration from XHTML pages because of the quirks thing.

Having said that, IE5 is always in quirks mode, and since IE5 is a bigger audience than IE6, therefore needs to be separately tested to look okay, maybe it doesn't matter - ie, if your layout is acceptible in quirks mode as well, may as well use the XML declaration.

liorean
04-24-2003, 03:03 PM
Originally posted by brothercake
You don't have a living to make then? :rolleyes: ;)
Not on web design...

I don't think dropping support for IE is practical, however desirable. I also exclude the xml declaration from XHTML pages because of the quirks thing.Well, there's a difference if you make websites that aren't singularly targeted at web designers, as most of my pages are. (It's been years since I did something for other audiences.) First of all, Mozilla is by far the most common client on my page. Second, my pages doesn't have to look the same as long as they are functional - I have no pressure on me to make things look nice, even though I try to make it so in moz at least.

Having said that, IE5 is always in quirks mode, and since IE5 is a bigger audience than IE6, therefore needs to be separately tested to look okay, maybe it doesn't matter - ie, if your layout is acceptible in quirks mode as well, may as well use the XML declaration. What? IE5 bigger audience? Have a look at <http://www.google.com/press/zeitgeist.html> in the "Web Browsers Used To Access Google" box. I'd say google is a fair representation of the web surfing poulation as a whole, and IE6 outgrew lower versions halfway into 2002.

The good thing about the xml declaration is that you can then hand all versions of iew pretty much the same stylesheets, and you don't have to fork your scripts for three alternatives when determining position, you can let it stay at two forks.


On the other hand, I think the xml declaration shouldn't be sent unless the document is an XML document - the SGML (text/html) version should be sent without it. And, guess what? MSXML doesn't have any knowledge of the xhtml namespace, so then you'd have to add behaviors or transform the document into SGML for it to be treaded as html. (Meaning default html rendering, default html behaviors etc.)

brothercake
04-24-2003, 03:29 PM
That's a very fair point - if your primary audience is mozilla then definitely play to mozilla. I find myself playing to mozilla anyway, but I still have to make things as good in IE, or at least, appear as good so that people who use IE won't notice what they're missing ;)

Seems my knowledge of browser stats is a bit out of date ... thanks.

That's interesting what you say about only sending the XML instruction if the document is really XML - makes a lot of sense. Something like this then:


<?php
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
header("Content-type: application/xhtml+xml");
echo ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
}
else { header("Content-type: text/html"); }
?>

Tails
04-24-2003, 08:08 PM
What is Quirks Mode?

liorean
04-24-2003, 08:31 PM
Have a look at <http://css-discuss.incutio.com/?page=RenderingMode>. Different browsers have different quirks mode and strict modes.

Alex Vincent
04-25-2003, 01:52 AM
Originally posted by cg9com
I would stay away from using the XML declaration for now in an HTML document, its not really needed as 1.0 is the only version(right?)

Actually, the W3C is working on XML 1.1, so starting to include that declaration for XML documents should be a good idea.

brothercake
04-25-2003, 01:58 AM
Originally posted by Alex Vincent
Actually, the W3C is working on XML 1.1, so starting to include that declaration for XML documents should be a good idea.
Would you agree with the notion that since XHTML served as text/html isn't really XML, then it shouldn't have the XML processing instruction?

jkd
04-25-2003, 02:48 AM
Originally posted by brothercake
Would you agree with the notion that since XHTML served as text/html isn't really XML, then it shouldn't have the XML processing instruction?

I would. :)

It's also not really XHTML. XHTML 1.1 must be served with an XHTML or XML mime-type, and prior versions are fed through an HTML parser when presented as text/html... <br /> (for example) might confuse some less tolerant parsers.

Tails
05-01-2003, 08:14 PM
Wah, ie5.0 doesn't support quirk mode. I wish it were possible to be updated.

brothercake
05-03-2003, 03:03 AM
Originally posted by Tails
Wah, ie5.0 doesn't support quirks mode.
On the contrary - ie5.0 is always in quirks mode.

Tails
05-03-2003, 05:11 PM
Oh, quirks mode is the less strict thing? I meant that it doesn't support the thing to say which mode it is in. well, it is correct that styles don't use quotes in inline sheets, right?

li{list-style-image:url(/gui/face1.gif)}

the things inside of url() are not quoted, correct?
and I also wouldn't quote them inside a style tag, right?
I may have this backwards, but if other people have future browsers that I will never see, I might as well learn this right.

cg9com
05-15-2003, 12:46 AM
Originally posted by Tails
Oh, quirks mode is the less strict thing? I meant that it doesn't support the thing to say which mode it is in. well, it is correct that styles don't use quotes in inline sheets, right?

li{list-style-image:url(/gui/face1.gif)}

the things inside of url() are not quoted, correct?
and I also wouldn't quote them inside a style tag, right?
I may have this backwards, but if other people have future browsers that I will never see, I might as well learn this right.
Quirks mode is what browser used to render in, (IE5-, NS4.x-)
newer browsers are capable of standards mode.

I dont believe you need quotes in a url(), no.

Tails
05-15-2003, 07:31 PM
Ok, so as far as browser compatibility, has anything started supporting XHTML and CSS2? I read about them everywhere and yet it seems like a fairy tale. Edit Plus even has syntax checking of CSS2 but I don't know any browsers that work with it.

liorean
05-15-2003, 07:48 PM
Mozilla has pretty solid support for CSS2. I'm told they even have support of the aural parts of it, though they haven't got a rendering engine that can use it. Opera 7 also has wide support of it, and Konqueror/Safari is gaining on them, too.

Opera 7 and Mozilla both have good XHTML and XML support, and I think you'll find it in Safari once expat gets ported. Apple are working on it.

In short, only ie is getting behind the development for the moment. Especially iem, which is getting really old.


In short, you have a pretty good base for XHTML and CSS2 right now, if you disregard ie (which is not anything most web designers can do). When Safari gets XML parsing and the next version of ie gets released, the path to XML from SGML will have begun for real.

Tails
05-15-2003, 08:17 PM
Oh, I am really behind. I haven't heard of half of those browsers. I have IE 5.0. I can't update it either. Microsoft's genious idea of making it so you have to have internet connection on the specific machine you want to update is sooo stupid. Why can't they let you download the IE 6 browser rather than a stupid live connection update that you cannot back up or transfer to a CD for people who have broken modems and/or not enough wealth to have internet?

liorean
05-15-2003, 08:35 PM
Go change computer, download and burn <http://browsers.evolt.org/download.php?/ie/32bit/6.0/ie60.exe> to a cd, and use that cd to install ie6.0. Or, you could go download Mozilla (http://mozilla.org/releases/) or Opera (http://opera.com/). There's also a lightweight Mozilla version called Phoenix (http://www.mozilla.org/projects/firebird/) (newly renamed Mozilla Firebird) that you can download and burn.

Without any plugins such as Java or Flash, these are all below 15 MiB in size, as compared to the 78 MiB of ie6.

Tails
05-15-2003, 08:50 PM
So there really is a burnable install for IE 6.0? Microsoft's useless costumer help lied to me! They just wanted to suck some shipping $ out of me for something free. Thanks. I'll look into that as soon as I get a CD-rom drive that can read CDs :( (mine is illiterate).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum