WordPress.org

Ready to get started?Download WordPress

Forums

HTML Strict Validation Problems: WP Output the problem? (2 posts)

  1. harveypooka
    Member
    Posted 7 years ago #

    I wrote all my templates as HTML Transitional because most templates were written in it and that's how I've been learning, ripping stuff apart, writing it again, etc. I'm now trying to write it as XHTML Strict (and I guess HTML 5 once browsers start supporting it!). This code:

    "<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>"/>"

    Will not validate as HTML strict, the validator gives an error of:

    "Line 10 column 127: character data is not allowed here.
    ...p-content/themes/default/style.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).

    Line 16 column 50: character data is not allowed here.
    <meta name="generator" content="WordPress 2.1.2" /> <!-- leave this for stats -->"

    I've looked at a few pages, tried to figure out what it hates but no clue. I think it's to do with WordPress PHP tags outputting text and trying to finish them with '/>' but I don't know a way around this. I guess it's modifying the WP output? But that's not the case for the '...style.css" />'.

    Am I missing the point? Any help would appreciated as I'm stumped!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Post a link to the validator showing this error. It's extremely difficult to diagnose your exact problem, because the validator isn't always specific about where the problem lies. You have to look at the context too.

    On the general theme, I was able to update my site to validate with Strict without too many issues. Getting it to XHTML 1.1 was much trickier. However, I eventually gave up on that and went back to Transitional. The benefit of being Strict or 1.1 compliant was basically non-existent, and very little cut-n-paste code would validate in it. Same went for many plugins. I was having to change things all the time to keep it valid.

    So I pushed it back to Transitional for now, and it's a lot simpler to cope.

Topic Closed

This topic has been closed to new replies.

About this Topic