About tests 37-41 (headers)

Hi,

I have improved the formalization rules for headers. The following XPath 
expressions address all headers that skip a downward sequence, according 
to tests 37-41.

For all of them (except for h1):

* The preceding header is calculated. If none, current header is badly
placed.

* We take the closest preceding header to the current one (we get that
with the [1]).

* We check if that closest header is OK:
H6's closest preceding header must be a h5 or h6.
H5's closest preceding header must be a h4 or h5 or h6.
H4's closest preceding header must be a h3 or h4 or h5 or h6.
H3's closest preceding header must be a h2 or h3 or h4 or h5 or h6.
H2's closest preceding header must be a any header.
For all: otherwise, current header is badly placed.

Comments?

The rules are the following:

//h6[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or 
self::h5 or self::h6][1][self::h5 or self::h6])]

//h5[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or 
self::h5 or self::h6][1][self::h4 or self::h5 or self::h6])]

//h4[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or 
self::h5 or self::h6][1][self::h3 or self::h4 or self::h5 or self::h6])]

//h3[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or 
self::h5 or self::h6][1][self::h2 or self::h3 or self::h4 or self::h5 or 
self::h6])]

//h2[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or 
self::h5 or self::h6][1])]

//h1[not(true())] (which is //h1[false()], which is () )

Vicente Luque Centeno
Dep. Ingeniería Telemática
Universidad Carlos III de Madrid
http://www.it.uc3m.es/vlc

On Thu, 16 Jun 2005, Vicente Luque Centeno wrote:

>
> All these examples also work with my rules :-)
>
> On Wed, 15 Jun 2005, Chris Ridpath wrote:
>
>> These tests are designed to detect when header levels are skipped in a 
>> downward sequence. For example:
>> h1 followed by an h2 is OK
>> h1 followed by an h3 is bad
>> 
>> Another example:
>> h3 followed by an h4 is OK
>> h3 followed by an h5 is bad
>> 
>> Header levels can be skipped in an upward sequence. For example:
>> h4 followed by an h2 is OK
>> 
>
>> On Wed, 15 Jun 2005, Vicente Luque Centeno wrote:
>>> Those h2 having no preceding h1 are an error:
>>> 
>> The group does not have a test for whether the first header in the document 
>> must be an h1.
>
> Neither of my expressions say that explicitly. However, by proper deduction 
> and combination of my rules, you will implicitly obtain that there is no 
> other possibility. So, yes, the first header in the document
> must be an h1 (or there should be no header at all) if tests 37-41 should be 
> followed. There is no explicit rule for that, but it is derived from tests 
> 37-41.
>
>> There are no tests that check for multiple h1s in the same document.
>
> That's why I did not include a rule saying:
>
> count(//h1) <= 1
>
> Cheers.
>
> Vicente Luque Centeno
> Dep. Ingeniería Telemática
> Universidad Carlos III de Madrid
> http://www.it.uc3m.es/vlc
>
>

Received on Monday, 20 February 2006 00:22:43 UTC