Skip to main content
Rsfl
Inspiring
January 9, 2014
Answered

Kontext rule for formatting only the first child section in a chapter

  • January 9, 2014
  • 1 reply
  • 689 views

Hi all, I have run into a DITA problem. Each chapter of the document, i.e. top-level topic, contains a miniature toc of the nested sections. Therefore the first child topic's title should receive a page break.

I tried this context rule for the title element, below you find the screenshot which I have tried to translate because the EDD is in German. Even though I define that the context should be the first parent topic only, the result is that every second-level topic now has a page break. Any ideas?

8. Count ancestors: topic

    concept

    task

    reference

    If level is: 2

      8.1 If context is: (topic{first} | concept{first} | task{first} | reference{first})

            ..then set page break.

Robert

This topic has been closed for replies.
Correct answer Lynne A. Price

R,

  You have discovered two details of context specifications:

  1. {first} means "first child of the parent" not "first child of this type of the parent"
  2. Only single elements are allowed in parenthesized groups.

You can replace your current rule 8.1 with separate tests for each topic type. In English, it would be:

8.1  If topic{after abstract}

            ...

       Else, if concept{after abstract}

            ...

       Else, if task{after abstract}

            ...

       Else, if referenc{after abstract}

--Lynne

1 reply

Rsfl
RsflAuthor
Inspiring
January 9, 2014

Note, I also tried the after.. indicator because the corresponding topics that should receive the page breaks are always the first following the abstracts which contain the toc.

The context rule looks líke this then:

       If context is: (topic{after abstract} | concept{after abstract} | task{after abstract} | reference{after abstract})

However the same problem occurres, all topic titles of the second level receive the page break instead of only those that directly follow the abstract.

Lynne A. PriceCorrect answer
Inspiring
January 9, 2014

R,

  You have discovered two details of context specifications:

  1. {first} means "first child of the parent" not "first child of this type of the parent"
  2. Only single elements are allowed in parenthesized groups.

You can replace your current rule 8.1 with separate tests for each topic type. In English, it would be:

8.1  If topic{after abstract}

            ...

       Else, if concept{after abstract}

            ...

       Else, if task{after abstract}

            ...

       Else, if referenc{after abstract}

--Lynne

Rsfl
RsflAuthor
Inspiring
January 10, 2014

Hi Lynn, thanks for the hint! Using multiple tests it works fine now. BTW it is a pain that Adobe translated the EDD element names for differrent installation languages, I think everybody on the globe who works with XML will by able to understand english tag names.

In case this is of interest for anyone, here is the resulting context rule in the German EDD: