what would be the equivalent line in HTML

Discussion in 'HTML' started by John Salerno, Feb 3, 2006.

  1. John Salerno

    John Salerno Guest

    I have this line in my XHTML template:

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

    If I create an HTML file instead, what should I put in the html tag instead?
    John Salerno, Feb 3, 2006
    #1
    1. Advertising

  2. John Salerno

    Steve Pugh Guest

    John Salerno wrote:
    > I have this line in my XHTML template:
    >
    > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    >
    > If I create an HTML file instead, what should I put in the html tag instead?


    <html lang="en">

    Steve
    Steve Pugh, Feb 3, 2006
    #2
    1. Advertising

  3. John Salerno

    Dylan Parry Guest

    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).

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
    Dylan Parry, Feb 3, 2006
    #3
  4. John Salerno

    John Salerno Guest

    Dylan Parry wrote:
    > 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).
    >


    Thanks guys, seems simple enough! But should there be anything
    additional in the html tag? Or is that other stuff just XHTML extras?
    John Salerno, Feb 3, 2006
    #4
  5. John Salerno

    cwdjrxyz Guest

    John Salerno wrote:
    > Dylan Parry wrote:
    > > 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).
    > >

    >
    > 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.
    cwdjrxyz, Feb 4, 2006
    #5
  6. John Salerno

    Andy Dingley Guest

    On Fri, 03 Feb 2006 21:20:10 GMT, John Salerno
    <> wrote:

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


    >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>)
    Andy Dingley, Feb 4, 2006
    #6
  7. Dylan Parry wrote:
    > 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).
    >


    In fact, "en" refers to English. If you want to specify British English,
    you use en-gb.
    Harlan Messinger, Feb 4, 2006
    #7
  8. John Salerno

    Guest

    Dylan Parry wrote:

    > "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...
    , Feb 4, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugo
    Replies:
    10
    Views:
    1,292
    Matt Humphrey
    Oct 18, 2004
  2. kaushikshome
    Replies:
    4
    Views:
    755
    kaushikshome
    Sep 10, 2006
  3. scad
    Replies:
    23
    Views:
    1,146
    Alf P. Steinbach
    May 17, 2009
  4. Replies:
    13
    Views:
    226
  5. Marek Stepanek
    Replies:
    12
    Views:
    402
    Peter J. Holzer
    Sep 2, 2006
Loading...

Share This Page