Do I realy need this html-dtd folder for xhtml? - xhtml

I asked myself, which function has a html-dtd folder with this files:
xhtml-lat1.ent
xhtml-special.ent
xhtml-symbol.ent
xhtml1-frameset.dtd
xhtml1-strict.dtd
xhtml1-transitional.dtd
I downloaded it from a German site, which recommend it when using xhtml.
Do I realy need it, if my head already looks like this?
<!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="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Maybe somebody could also explain what these files actualy do.

Related

Internet Explorer Shows XHTML page without CSS, yet shows CSS on Firefox and Chrome

The raw XHTML is just displaying in internet explorer. No CSS is shown at all. I can't seem to pinpoint the issue of this problem. I ran both my XHTML and CSS through the W3C validators and had zero errors checked with XHTML 1.0 Strict and CSS 2.1.
I suspect the something to do with my DOCTYPE or the <link> in my XHTML. Any help is appreciated!
XHTML (DOCTYPE and HEAD):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- DOCTYPE is set to STRICT-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Flags</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="Flags.css" type="text/css" />
</head>
</html>
Page in:
Internet Explorer: http://i.imgur.com/l2jcUkv.png
Chrome: http://i.imgur.com/tucKXzg.png
Notes: The CSS is called Flags.css and is located in the same directory as the XHTML.
Check the developer tools in Internet Explorer. Are you using the correct mime for your CSS? What about headers you've set?
Remove the meta element, it is not only invalid it's completely out of context for XHTML; you are setting the mime to application/xhtml+xml right?
Never use capitol letters for files unless they are intended as an explicit download-only resource; all web resources must be lower case as part of your good practices (and use dashes for public facing URLs, never underscores; research correct context of characters on Wikipedia).
Finally you're lacking the media attribute with the screen value...
<?php
if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml'))
{
header('Content-Type: application/xhtml+xml; charset=utf-8');
}
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Flags</title>
<link href="flags.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
</body>
</html>
My entire site is proper XHTML (1.1 currently, converting to XHTML5 for the next version release) so feel free to look at it linked from my user profile.

Print javascript using R?

I would like to produce a text file so an engineer can run the java script. It has a header (top portion) that never changes like below (snippet).
<!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">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
var myChart = new Chart.Bubble('myChartContainer', {
width: 500,
height: 500,
After this chunk will be my R analysis output. So far this is what I tried (very manual but doesn't work, regardless). I tried paste(), cat() too but it didn't work either.
print("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"")
Is there any way to plant this chunk of code nicely in text file using R?
You can copy and paste the info. The only problem is escaping the special characters. So use readLines which will escape them for you.
headerInfo <- paste(readLines(file("clipboard")), collapse="\n")
cat(headerInfo)
<!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">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
You need to escape the quote marks so that R doesn't think that the string ends after PUBLIC.
The backslash \ is used to escape characters, E.g:
print("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"")
And if your string has a backslash, you need to put two backslashes in the print function.

What's the best way to add a CSS file to the XHTML page

Option 1 <?xml-stylesheet?>
<?xml-stylesheet href="style.css" type="text/css"?>
<!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" lang="en" xml:lang="en">
<head>
<title>Title</title>
</head>
<body></body>
</html>
Option 2 <link/>
<!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" lang="en" xml:lang="en">
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body></body>
</html>
Both works. Just wondering which is better.
Thanks.
<link> is more cross-browser compatible. Having anything before the DOCTYPE declaration tends to lead to unexpected results, especially in older browsers.
Furthermore, <?xml-stylesheet?> is designed for XML. Unless you're sure your XHTML page is being served in XML mode you should avoid it anyway.
Second option is more comfortable to use still if you have to link more than one stylesheet then you would like to add <link> easily.

CSS Menu Not working in IE, work fine in Chrome and Firefox [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I have a CSS menu that works fine in chrome and firefox, but not in IE.
Any ideas why?
Looking at the source, the Doctype is in the wrong place, which force IE to render in Quirks mode.
Also consider adding the follow meta tag to force IE to render with the latest engine,
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Your HTML isn't right
<head>
<title>Career Media Mobile</title>
<meta charset="UTF-8">
<link href="css/dropDown.css" rel="stylesheet" type="text/css">
</head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body bgcolor="#D2D1CF">
should be
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Career Media Mobile</title>
<meta charset="UTF-8">
<link href="css/dropDown.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#D2D1CF">
That will help something I gues

Why does £ turn to A using xhtml and css

I have noticed when i put a £ sign in it turns out to be a A when i look at my website in firefox. Do you know the reason why this is happening?
Thanks
it sounds like you've got a page encoded in UTF-8, but being displayed as Latin-1 - make sure the meta tags and/or server headers tell browser what encoding the page uses.
In an XHTML file, you need to declare the encoding in the initial XML tag, and for maximum compatibility, include a meta tag also
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
...
</head>
Bobince suggests in a comment that for maximum backwards compatibility you do something like this
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
...
</head>
If you're curious why you get strange letters, here's the likely explanation...
The pound sign is Unicode character U+00A3
This is encoded in UTF-8 as the two byte sequence C2 A3
if you interpreted that as Latin-1, you'd get ã

Resources