W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

RE: Bug report: LINK tag not well-formed in output

From: Randy Waki <rwaki@flipdog.com>
Date: Wed, 6 Sep 2000 13:12:53 -0600
To: "Evan Lenz" <elenz@xyzfind.com>, <html-tidy@w3.org>
Message-ID: <003001c01836$74be19d0$51eee13f@rwaki>
Evan Lenz wrote:
> 
> This code:
> 
> <STYLE>
> <LINK REL="stylesheet"
> HREF="http://www.thestreet.com/tsc/common/stylesheets/global.css"
> TYPE="text/css">
> </STYLE>
> 
> Resulted in (XHTML mode):
> 
> <LINK REL="stylesheet"
> HREF="http://www.thestreet.com/tsc/common/stylesheets/global.css"
> TYPE="text/css">
> 
> 
> Besides the fact that it's not XHTML (lower case), it's not well-formed, as
> it should be an empty element.
> 
> I understand what the problem is here: <LINK> should be under <HEAD>, not
> <STYLE>.  For my application, I don't particularly care if the XHTML output
> is valid or not, but I definitely care if it's well-formed.
> 
> It would be nice if there was a way to incorporate, say, a SAX parser to
> ensure the output is well-formed, and give the user options as to what to do
> when it's not well-formed.  I would like a method returning true or false,
> to let me know whether I should go on or not.
> 
> What exactly is the criterion for Tidy outputting something versus nothing?
> In this case, <LINK> in its context, should be an unrecognized element...
> 
> Any further thoughts on this would be appreciated.

This is related to the JavaScript problem I mentioned in my previous
reply.  Tidy is interpreting the style element's content as just text,
not a tag to be tidied.  The "proper" XHTML output should escape the <
preceding the LINK, or wrap the content in a CDATA section.  The problem
is that, as you indicated in another message, many Tidy users want
Tidy's XHTML output to be directly renderable by today's browsers where
escaped <'s and XML CDATA sections aren't recognized.

One workaround is for Tidy to hide the CDATA section markup in comments.
This produces well-formed XML and that is also directly renderable by
existing browsers.  The gotcha is that every script and style language
has its own comment syntax, so Tidy can only recognize a limited set.

--Randy
Received on Wednesday, 6 September 2000 15:14:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT