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

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 UTC