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

Re: HTML heading hierarchy for XHTML

From: P. T. Rourke <ptrourke@mediaone.net>
Date: Tue, 1 Feb 2000 12:22:53 -0500
Message-ID: <002801bf6cd8$fd68c1e0$c38ee9d8@psicorp.com>
To: <html-tidy@w3c.org>
I originally sent this offlist, but I see from JQ's comment that it might be
of further interest.

JC - name vs. id : Yeah, slipped up - I forget and tend to assign name to
elements that it never covered in place of id because on older browsers name
tends to be more reliable than id for anchoring purposes.  One of the
hazards of writing cross-browser/legacy-browser code.

MR - Lengthy, sorry; and I'm sorry too is some of this is too elementary:

IDed divs is the way to go, because it is not the relationship between
headings that you're trying to manifest, but the "container" relationship of
sections and subsections; i.e., the chapter heading for a book doesn't
contain the section heading, but the chapter contains the section.  The
markup in HTML of headings into h1, h2, ... h6 implies the structural
relationship, but though intended to be structural/semantic they are really
presentational.  For example, this kind of XML scheme


would be more precise SEMANTICALLY, really; Given that, the HTML scheme is
more manageable for everyday documents.

Given the XML scheme above, one could then add classes like so:

<heading class="Section">

but this would be redundant; in an XML+CSS document, the user agent should
present a section1 heading differently from a section2 heading if the style
sheet directs it to; thus this should work:

section1 heading {font-size: 12pt}
section2 heading {font-size: 10pt}

But redundant though it is, I'd prefer



<section1><heading> etc.

Thus the div elements marked up with id (and perhaps class; see below).

As you can see, the CSS markup for the XHTML h1 is easier than it would be
for an XML section1 heading .

h1 {font-size: 12pt}
h2  {font-size: 10pt}


The usual reason for using the class attribute rather than the id attribute
would be if you were defining an entire class of things - for instance,
ideally in XHTML I'd want to use

<div class="Section" id="Section.1">
<div class="Subsection" id="Section.1.1">

(You might want to use Section.1.0 for the first-level heading, though, as
some user agents have trouble distinguishing an 11 character id from a 10
character id if the first 10 characters are the same). One could then use
CSS to control the presentation of all Sections so that they have, say, a
point size of 12pt and no indentation, and all Subsections so they have a
point size of 10pt and a 5em indentation. You might want to look at the TEI
DTD for SGML (and soon XML, I think) to see how they handle semantic markup
of complex texts (I don't have the URI with me right now, I'm afraid).

Patrick Rourke

----- Original Message -----
From: "Jelks Cabaniss" <jelks@jelks.nu> (edited by PTR)

> P. T. Rourke wrote:
> > <div name="sec1"><h1>First Order Heading</h1>
> Yes.  But there is no "name" attribute for div.  You probably meant "id":
>   <div id="sec1">
> /Jelks

----- Original Message -----
From: "Jany Quintard" <quintard.j@cgi.fr>
To: <html-tidy@w3c.org>
Sent: Tuesday, February 01, 2000 11:42 AM
Subject: Re: HTML heading hierarchy for XHTML

> On Tue, 1 Feb 2000, Marc Rubin, Jay's Island Software Development &
Consulting wrote:
> > My goal is -automated- conversion of many existing HTML documents to
> > .../...
> > that... but Tidy appears to be the right tool for the job.
> >
> > Both of the nested "div" suggestions work acceptably in w3c's Amaya
> > -- thanks for the feedback. Conversion to "name"ed divs seems more
> > than "class"ified paragraphs, but I may be missing some other advantage.
> >
> > The question now is whether either of these solutions could be
> > into Tidy as an option?:
> >
> >
> > <!-- Courtesy of P. T. Rourke -->
> > <div name="sec1"><h1>First Order Heading</h1>
> > <p></p>
> > <div name="sec1.1"><h2>Second Order Heading</h2>
> > <p></p>
> > </div>
> > </div>
> The problem here is that (if as Jelks Cabaniss said) name is ID, the
> structure of the file is not easy to modify, because, when you add a
> division somewhere, all IDs after it have to be modified.
> > or
> >
> > <!-- Courtesy of Jany Quintard (modified) -->
> > <div>
> >   <p class="heading">First Order Heading</p>
> >   <div>
> >     <p class="heading">Second Order Heading</p>
> >     ........
> >   </div>
> > </div>
> >
> > I'd appreciate feedback on feasibility from anyone familiar with Tidy's
> > source code?
> I am not familiar with Tidy code :-(
> I prefer the second solution because it is a way to get rid of hn
> elements which IMO are not needed. What we should need in
> well-structured HTML would be a <divtitle> element (But this is my
> preussian-psycho-rigid view of SGML/XML languages). Actually, hn are
> useful shortcuts, but the purity of the model suffers from them.
> And the XHTML DTDs do *not* have any divtitle element.
> The tools to make the transformation is *not* Tidy, but some SGML tool
> (like OpenJade for example, but there must be others).
> Jany.
Received on Tuesday, 1 February 2000 12:20:44 UTC

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