W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2002

Re: Bug: HTML Tidy and tidying up Server-side Includes (SSI)

From: Klaus Johannes Rusch <KlausRusch@atmedia.net>
Date: Mon, 25 Feb 2002 20:37:15 CET
Message-Id: <200202252031.PAA22724@tux.w3.org>
To: html-tidy <html-tidy@w3.org>
Cc: "PRICE, Paul" <Paul.Price@qed.qld.gov.au>
In <C7A0A0979B09D311877400A024B3D410041B2069@eco88340009.qed.qld.gov.au>, "PRICE, Paul" <Paul.Price@qed.qld.gov.au> writes:
> * EXPECTED RESULT: I want to take a Server-Side Include HTML file and tidy
> it up. The file only contains the information which would normally appear
> *inside* of but not including the <BODY> tag. As server-side includes work
> by embedding commands in HTML comments ( for instance <!--#include
> virtual="/ssi/file.shtml" --> ) all comments should be preserved and in
> addition preserved as-is.

Unfortunately there is no way for tidy to tell which components of the page get
included with

        <!--#include virtual="/ssi/header.html" -->

You seem to include body elements and therefore expect the SSI in the body,
however header.html could just as well include an XML declaration which needs 
to be included before the DOCTYPE.

> Result: Notice how the SSI is placed in the wrong place at the TOP of the
> output (first line). It should be INSIDE the body tag!!
> Possibility: My guess is that htmltidy is viewing the first comment line in
> the file as if it is the doctype; however, this is incorrect behaviour in
> this case.

Simply put, tidy is reading a comment, which can appear anywhere, therefore
adding it to the output tree, then it reads an <h2> which requires a preceeding
<body> tag so it generates the missing parts of the HTML tree, then adds the 
<h2> tag in <body> context.

> Possibility: My guess is that htmltidy is viewing the first comment as a
> part of the <HEAD> and stripping it; however this is incorrect behaviour in
> this case.

See above, the comment is valid outside of the <body> and is placed outside of 
the <body> in the generated content tree, so it is not output when requesting
body only.

Not sure how to best resolve this, maybe results would more closely match
expectations my attaching comments to the following elements (apart from
implementation issues, can anyone think of a good reason why a comment
should be attached to the following element?)

Klaus Johannes Rusch
Received on Monday, 25 February 2002 15:31:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:51 UTC