SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why isnt my <link rel="stylesheet"... XHTML 1.1 valid?

    Hi,

    I am having a problem getting part of my code to validate in XHTML 1.1 Strict.

    The offending line is

    <link rel="stylesheet" href="/wideTemplateStyles.css" type="text/css" />

    This is the error I am given:

    Error Line 19 column 100: character data is not allowed here.

    ...TemplateStyles.css" type="text/css" />

    You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


    Thanks, i'm scratching my head for this!

  2. #2
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I appear to have found my problem.

    If I remove the backslash at the end it accepts it.

    I now have "Failed validation, 0 error" grrr

    It must be to do with these two items:


    Unknown Parse Mode!

    The MIME Media Type (text/html) for this document is used to serve both SGML and XML based documents, and it is not possible to disambiguate it based on the DOCTYPE Declaration in your document. Parsing will continue in SGML mode.
    Namespace Found in non-XML Document

    Namespace "" found, but document type is not XML!


    Any ideas?

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should not serve an XHTML 1.1 document as text/html, since it's not backwards compatible. Either serve it as application/xhtml+xml (and lose IE users) or use XHTML 1.0 Strict.

    BTW, there is no XHTML 1.1 Strict; there's only one XHTML 1.1 DTD and it's just called XHTML 1.1.

    Removing the slash from the <link/> tag is definitely not recommended. That means you'll have a purported XHTML document that will crash with a well-formedness error if served as such.
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    You should not serve an XHTML 1.1 document as text/html, since it's not backwards compatible. Either serve it as application/xhtml+xml (and lose IE users) or use XHTML 1.0 Strict.

    BTW, there is no XHTML 1.1 Strict; there's only one XHTML 1.1 DTD and it's just called XHTML 1.1.

    Removing the slash from the <link/> tag is definitely not recommended. That means you'll have a purported XHTML document that will crash with a well-formedness error if served as such.
    Thanks Autistic.
    As it happens I have just managed to get my page to validate it in XHTML 1.1. I hadn't realised there was no 1.1 Strict - I was upgrading from 1.0 to 1.1 and sinply changed the version number.

    For your info, the working header is:

    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title><?php echo $title; ?></title>

    <!--
    ==========================================================================
    Mark Corbyn - http://www.markcorbyn.com

    Copyright (C) Mark Corbyn. All rights reserved.
    ==========================================================================
    -->

    <link rel="stylesheet" href="/wideTemplateStyles.css" type="text/css" />
    <link rel="stylesheet" href="/contentStyles.css" type="text/css" />

    <link rel="icon" type="image/ico" href="/favicon.ico" />


    I was concerned about the closing tag being omitted. My working version includes the closing tag

    Would this still cause problems for IE users? I have tested it in IE and it works fine for me.

    If anyone is interested the page I was validating was http://www.markcorbyn.com/hobbies/web_design/

    Thanks
    d418rf

  5. #5
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you're going to give this to IE users and serve it as text/html (see your <meta> tag) use XHTML 1.0. There is no real reason for you to use XHTML 1.1 except for nerdy ego-inflation.

  6. #6
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the advice Raffles.

    I just wonder, could someone explain to me the problem with serving it as text/html ? Since all of my browsers (including IE) seem to render it correctly.

    Thanks

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Frequently Asked Questions About XHTML vs HTML should give you an idea.

    Basicly, you are not using XHTML at all. You are just using badly written HTML, that happens to validate as XHTML 1.1.

    IE does not support XHTML in any way, shape or form. If you need to support IE, you should use HTML 4.01 Strict, or possibly XHTML 1.0 Strict conforming to Appendix C of the XHTML 1.0 specification, served as text/html.
    Birnam wood is come to Dunsinane

  8. #8
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There is nothing wrong with text/html, it's the best thing to use at the moment. As AutisticCuckoo says above, the problem comes with application/xhtml+xml, which IE doesn't understand. application/xhtml+xml is what you should use with XHTML 1.1 and so therefore if you use XHTML 1.1 and serve your document as text/html, you're doing it wrong.

    This is why you should use XHTML 1.0 and text/html.

  9. #9
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks

  10. #10
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    This is why you should use XHTML 1.0 and text/html.
    Or, better yet, HTML 4.01 Strict and text/html.
    Why not be honest?

    There's nothing wrong with using XHTML 1.0 served as text/html, provided it still works when served as an application of XML.
    But there is no gain whatsoever, either. (At least not from a technical point of view.)
    Birnam wood is come to Dunsinane

  11. #11
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    But HTML 4.01 isn't cool any more! Even if it has Strict after it!

  12. #12
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    But HTML 4.01 isn't cool any more!
    To the contrary.
    Simon Pieters

  13. #13
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    But it's old. This newer thing is cooler. Plus it has an X in front of it, so that makes it extra cool.

  14. #14
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it was cool 5 years ago. Now we know the X doesn't bring any benefit and so it makes the whole thing a big joke. Y'know, XHTML is by definition HTML 4.01, just as an application of XML. People don't want to use an application of XML (for various reasons -- e.g. they don't like drocanian error handling, or they want to support IE and Google, which are both very valid reasons), but still want to use the "latest and greatest".

    Give it up.
    Last edited by zcorpan; Dec 12, 2006 at 18:02. Reason: misspelling
    Simon Pieters

  15. #15
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML 4.01 specification, W3C recommendation 24 December 1999
    XHTML 1.0 specification, W3C recommendation 26 January 2000

    Yeah, HTML is old. XHTML is so much newer ... almost a whole month!

    Age doesn't really matter. What matters is what is supported by our visitors' browsers. The latest markup specification with any support worth mentioning is HTML 4.01.

    Until Microsoft incorporates true XHTML support into Internet Explorer, there is very little use for XHTML on general-audience sites. And going by their track records when it comes to standards, it will probably be IE12 before they get it right.
    Birnam wood is come to Dunsinane

  16. #16
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the benefit of our Swedish friends I'd like to point out that Raffles is giving your legs a good, hard tug.

  17. #17
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yep.

    Congrats on becoming an advisor, Mr Olsson.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •