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

Re: HTML heading hierarchy for XHTML [RE-POST]

From: Jelks Cabaniss <jelks@jelks.nu>
Date: Tue, 1 Feb 2000 11:27:09 -0500
To: <html-tidy@w3c.org>
Message-ID: <NBBBICMNIPCICMKJECCBKEGADFAA.jelks@jelks.nu>
Marc Rubin wrote:

> I'd like to preserve the implicit hierarchy of HTML headings when
> converting to XHTML. For example, I'd like to end up with this XHTML output:
>
> <h1>Heading 1 text
>         <h2>Heading 2 under heading 1</h2>
> </h1>
>
> Would this translation be feasible as an option in Tidy?

Not unless Dave decides to let Tidy emit invalid [x]HTML.  If you look at the
xHTML DTD[1], you will see that headings and paragraphs are defined as
block-level elements that can not contain other block-level elements, only
"text" and inline-level elements (like i, em, strong, etc.).

Also, if you think about it for a minute, you'll understand why.  Your example
above shows a Heading-Level-2 *INSIDE* a Heading-Level-1.  Why would one want a
heading inside another heading?  If you really do have some reason you want to
do this, you'll have to invent your own document type, but it wouldn't be what
we call XHTML or HTML.

[1] http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

/Jelks
Received on Tuesday, 1 February 2000 11:29:09 GMT

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