[thelist] skipping 'hx' levels is bad

Liorean Liorean at user.bip.net
Wed Jan 16 13:53:53 CST 2002


At 13:24 2002-01-16 -0500, rudy wrote:
> > Of course, that's a very strict interpretation...
>
>perhaps not strict enough
>
> > ... both in terms of writing and layout, but since HTML
> > was intended to mark up written documentation, I stand
> > by that interpretation.   YOMV (your opinion may vary).
>
>indeed
>
>lemme ask you, does your interpretation allow P text inserted "in between"
>these heading levels, like an introductory paragraph?
>
>    <h1>stooges</h1>
>    <p>introductory comments, a page and a half</p>
>    <h2>curly</h2>
>          <p>stuff about curly</p>
>    <h2>larry</h2>
>          <p>stuff about larry</p>
>    <h2>moe</h2>
>          <p>stuff about moe</p>
>    <p>wrapup comments</p>
>
>since you are a markup fanatic, tell me where that last paragraph gets
>parsed in the document hierarchy
>
>now tell me how to fix it so that it's as "pure and semantically correct"
>as not skipping an H level



Hmm, I've had a similar discussion to this one on Webdesign-L...
There's two ways for markup to denote where a text belongs, flat and 
hierarchical.
Now, in HTML you can use both, but the evident one built into the markup is 
flat.

The heritage of the flat model works according to the following rule:
All headers belong to the nearest header of higher level declared prior in 
the document.
All paragraphs belong to the nearest header declared prior in the document.

And in this case, "the document" refers not to the HTML file, but to the 
parent element of the textual markup. I'll give you an example:

/- - -/
<body>
<div> <!-- first document -->
   <h1 id="head1-0-0">This or that</h1>   <!-- main header -->
     <p>the <br />text</p>   <!-- paragraph belonging to 'head1-0-0' -->
     <h3 id="head1-0-1">Section 1.0.1: Thanks</h3> <!-- third level header 
being direct child to 'head1-0-0' -->
       <p>to mommy<br />and my friend Dany</p> <!-- paragraph belongs to 
'head1-0-1' -->
     <h2 id="head1-1-0">Chapter 1.1: And thus it began...</h2> <!-- second 
level header being direct child to 'head1-0-0'-->
       <p>descriptive text</p> <!-- paragraph belonging to 'head1-1-0' -->
       <h3 id="head1-1-1">Section 1.1.1: This</h3> <!-- header being direct 
child to 'head1-1-0' -->
         <p>some text</p> <!-- paragraph belonging to 'head1-1-1' -->
         <p>more text</p> <!-- paragraph belonging to 'head1-1-1' -->
   <p>even more text</p> <!-- paragraph that even though indention suggests 
otherwise belongs to 'head1-1-1'-->
</div>
<div> <!-- second document -->
<h1 id="head2-0-0">other document</h1> <!-- main header -->
   <p>text</p> <!-- paragraph belonging to 'head2-0-0' -->
</div>
</body>
/- - -/


Which would give the following hierarchical structure:

first document:
head1-0-0
 >head1-0-1
 >>p
 >head1-1-0
 >>p
 >>head1-1-1
 >>>p
 >>>p
 >>>p

second document:
head2-0-0
 >p




the other way of achieving the same thing would be hierarchical (XMl 
example, you could use divs in HTML to achieve the same effect, but this 
way the structure is more apparent to the reader):
/- - -/
<document header="This or that"> <!-- head1-0-0 -->
   <paragraph>the<newline/>text</paragraph>
   <section header="Section 1.0.1: Thanks"> <!-- head1-0-1 -->
     <paragraph>to mommy<newline/>and my friend Dany</paragraph>
   </section>
   <chapter header="Chapter 1.1: And thus it began..."> <!-- head1-1-0 -->
     <paragraph>descriptive text</paragraph>
     <section header="Section 1.1.1: This"> <!-- head1-1-1 -->
       <paragraph>some text</paragraph>
       <paragraph>more text</paragraph>
       <paragraph>even more text</paragraph>
     </section> <!-- head1-1-1 -->
   </chapter>
</document>
<document header="other document"> <!-- head2-0-0 -->
   <paragraph>text</paragraph>
</document>
/- - -/



Now for the question at hand. First of all, you see that I used a header 
jump there. Why did I do that? Well, sometimes you have a situation such as 
this, where either text or a lower-level header doesn't belong to any 
middle-level header, but instead directly to the upper-level header. It's 
most apparent that technical documents might need a structure such as this. 
Second, this way is how most markup driven word processors handle the same 
thing, and it allows for an easy conversion between the two.

There's also the question of making structure that you easily can create a 
disposition of. Many companies and universities use index-creation - and 
create dispositions for documents - through analysing the HTML according to 
document semantics, so that's why you should use the textual markup made 
for this instead of creating a hierarchical system of your own through divs.


// Liorean, aware that this is more a linguistical question than one of markup.





More information about the thelist mailing list