what would be the equivalent line in HTML

D

Dylan Parry

Pondering the eternal question of "Hobnobs or Rich Tea?", John Salerno
finally proclaimed:
If I create an HTML file instead, what should I put in the html tag
instead?

From the XHTML version, you get:

<html lang="en">

That's all there is to is. It is also important to make sure that you
get the correct language code in there. "en" refers to British English,
so if you are using American English it should be "en-us" (with similar
alterations for Canadian "en-ca" and Australian "en-au" English).
 
J

John Salerno

Dylan said:
Pondering the eternal question of "Hobnobs or Rich Tea?", John Salerno
finally proclaimed:


From the XHTML version, you get:

<html lang="en">

That's all there is to is. It is also important to make sure that you
get the correct language code in there. "en" refers to British English,
so if you are using American English it should be "en-us" (with similar
alterations for Canadian "en-ca" and Australian "en-au" English).

Thanks guys, seems simple enough! But should there be anything
additional in the html tag? Or is that other stuff just XHTML extras?
 
C

cwdjrxyz

John said:
Thanks guys, seems simple enough! But should there be anything
additional in the html tag? Or is that other stuff just XHTML extras?

In fact "that other stuff" may be a validation error in one or all of
the 3 html 4.01 flavors. Always use the correct Doctype and take your
code to the W3C html validator. It is especially fussy about the
Doctype and html/xhtml tags, and it usually will tell you if there is
an error in them. One error that surprises some people the first time
it happens is that, unlike most html(not xhtml) tags, the Doctype tag
is case sensitive. That is one reason why it is nice to store your
Doctypes somewhere so that you only have to copy and paste them to
avoid typos.
 
A

Andy Dingley

Thanks guys, seems simple enough! But should there be anything
additional in the html tag? Or is that other stuff just XHTML extras?

XML extras really. This is why they're one of the few changes from HTML
4.01 -> XHTML. XHTML never really adds anything new, it just
reformulates HTML 4.01 in XML


xmlns="http://www.w3.org/1999/xhtml"
is a "namespace", as described here
http://www.w3.org/TR/REC-xml-names/

Arjun might pop up to explain why namespaces were badly designed, but
they are a vaulable feature of XML (maybe they were done badly, but
they're still useful).

Namespaces do a couple of things - they're an alternative to a doctype
and can be used to refer to an XML Schema instead. Secondly they're an
easy way to include elements from multiple schemas, so that you can very
easily embed Dublin Core or SVG elements into your HTML in a valid and
easily processed manner.

Sadly namespaces are an XML feature, definitly not SGML. So for
"Appendix C" XHTML, they are of no use whatsoever. They don't hurt
anything when used like this, but neither are they visible to web agents
that are receiving XHTML labelled as text/html.

You should always include the xhtml default namespace in an XHTML
document, whether it's Appendix C or not. But if you take namespaces
further and try to include namespaced elements, then you're no longer
looking like vaguely valid HTML and you've stepped ouside Appendix C.
Things may start to break at this point!

It's maybe worth reading the old HTML guidance on processing unknown
items in a HTML document. These are well-supported and have allowed much
useful work to be done, even with the worst invalidities. Perhaps
they've also encouraged such practices..... Unknown attributes should
be ingnored silently. Unknown elements should be ignored, but their
contents rendered (as if the element wasn't there)
http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.1

So use bizarre attributes without too much worry, but be careful of
elements with content, lest that content suddenly appear in your HTML
page where you weren't expecting it.



xml:lang="en" is described in the XML spec.
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-lang-tag

and mentioned in the XHTML spec here
http://www.w3.org/TR/xhtml1/#C_7

Note that although this is a standard XML feature, it's not an implicit
feature. You still need to define the attribute in the application's
DTD, hence the XHTML DTD contains the following snippet.

<!-- internationalization attributes
lang language code (backwards compatible)
xml:lang language code (as per XML 1.0 spec)
dir direction for weak/neutral text
-->
<!ENTITY % i18n
"lang %LanguageCode; #IMPLIED
xml:lang %LanguageCode; #IMPLIED
dir (ltr|rtl) #IMPLIED"
This attribute is in turn part of the %attrs; entity, and so is allowed
on most XHTML elements (any of them, except for elements used in <head>)
 
H

Harlan Messinger

Dylan said:
Pondering the eternal question of "Hobnobs or Rich Tea?", John Salerno
finally proclaimed:


From the XHTML version, you get:

<html lang="en">

That's all there is to is. It is also important to make sure that you
get the correct language code in there. "en" refers to British English,
so if you are using American English it should be "en-us" (with similar
alterations for Canadian "en-ca" and Australian "en-au" English).

In fact, "en" refers to English. If you want to specify British English,
you use en-gb.
 
D

dorayme

Dylan said:
"en" refers to British English,
so if you are using American English it should be "en-us" (with similar
alterations for Canadian "en-ca" and Australian "en-au" English).
This fair dinkum, there is an au? Deadset? Well well! Think I will go
have a dingo's breakfast...
 

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

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top