Generation of Table of contents and index page

Post here questions and problems related to editing and publishing DITA content.
Manohar_1024
Posts: 53
Joined: Wed Mar 27, 2019 10:12 am

Generation of Table of contents and index page

Post by Manohar_1024 »

Hello,
I need automatic generation for table of contents and index pages.
As for TOC if page numbers in body changes due to some alignments then in TOC also it should update.
Please help me in this thing.I need this urgently
Thank you.
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Generation of Table of contents and index page

Post by Dan »

Any DITA map generates in the PDF output a table of contents.
If the topics contain indexterms, these are collected and added to an index page at the end of the publication.
Try transforming the DITA samples bundled in oXygen and see the output.

Many regards,
Dan
Manohar_1024
Posts: 53
Joined: Wed Mar 27, 2019 10:12 am

Re: Generation of Table of contents and index page

Post by Manohar_1024 »

Hello,
Thanks for the reply.
I have got that for my output i want in index like
T
Table of contents 3
Turbine 6
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Generation of Table of contents and index page

Post by Dan »

It is not clear, you succeeded in having a TOC and Index?
If not, please read below:

The index section collects all the index terms from the publication and shows them in a sorted tree.
To add index to your publication, you just need to add index terms to the topics metadata:

Code: Select all


  <title>The topic title.</title>
<prolog>
<metadata>
<keywords>
<indexterm>Installing <indexterm>Water Pump</indexterm></indexterm>
</keywords>
</metadata>
</prolog>
<body>
.....
or in the content itself:

Code: Select all


...
<p>Open the lid then turn the body pump to the right.
<indexterm>Installing <indexterm>Water Pump</indexterm></indexterm>
</p>
...
In case you are using a bookmap, you need to specify where the index list should be presented, for instance in the backmatter of the book. This is done by using an indexlist element in the booklists if the backmatter:

Code: Select all


<bookmap>
...
<chapter href="tasks/troubleshooting.dita">
...
</chapter>
<backmatter>
<booklists>
<indexlist/>
</booklists>
</backmatter>
</bookmap>
For plain maps, the index list is automatically added at the end of the publication, with no need to modify the map.

Also, for plain maps, the TOC is automatically generated.

For DITA Book Maps you will need to add a toc element in the booklist element from the frontmatter:

Code: Select all


<bookmap>
...
<frontmatter>
<booklists>
<toc/>
<figurelist/>
<tablelist/>
</booklists>
</frontmatter>
...
...
Many regards,
Dan
Manohar_1024
Posts: 53
Joined: Wed Mar 27, 2019 10:12 am

Re: Generation of Table of contents and index page

Post by Manohar_1024 »

Thanks Dan,
i have got that
i am getting in this way
A
Air dryers
31
Alarm
23
Auxiliary compressors
34

but Now what i want is.... in Index

A
Air dryers........................................2.31
Alarm............................................3.23
Auxiliary compressors.........................3.34
Here the above numbers (2.31) means 2 is a chapter number and 31 is the page number.
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Generation of Table of contents and index page

Post by Dan »

Hello,
Unfortunately putting the chapter number before the page number is not supported by the transformation.

But putting a line of dots between the indexterm and the page can be done like this:

Code: Select all


*[class~="index/formatted-value"],
*[class~="index/refid"] {
display:inline;
}

*[class~="index/entry"] {
text-align:justify;
}
*[class~="index/entry"] *[class~="index/formatted-value"]:after {
content:leader('.');
}

Many regards,
Dan
Manohar_1024
Posts: 53
Joined: Wed Mar 27, 2019 10:12 am

Re: Generation of Table of contents and index page

Post by Manohar_1024 »

Hello Dan,
Thanks for the reply but i am getting an error like this.

Description: Transformation failed. C:\Program Files\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\build.xml:603: Java returned: 1
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Generation of Table of contents and index page

Post by Dan »

Send to the support@oxygenxml.com the transformation console log.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Generation of Table of contents and index page

Post by chrispitude »

Hi Dan,

We have <indexterms> in our DITA (it's content converted from FrameMaker), but we don't want to generate the index or its TOC entry at this time. How do we suppress index generation in PDF Chemistry?

At

https://www.oxygenxml.com/doc/versions/ ... om_the_toc

the "hide.frontpage.toc.index.glossary" parameter is mentioned, but we still want the frontmatter and TOC.

Thanks!
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Generation of Table of contents and index page

Post by Costin »

Hi Chris,

You could remove the Index references (from TOC/content/bookmarks), by using a CSS customization, like:

Code: Select all

*[class~="indexlist"]{
    display: none;
}

*[class~="index/groups"]{
    display: none;
    counter-reset: none;
    bookmark-level: 0;
}
This way you would remove only the Index, without using the dedicated predefined parameter (that, indeed, would also hide other components, like front page, TOC, etc.)

Cheers,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Manohar_1024
Posts: 53
Joined: Wed Mar 27, 2019 10:12 am

Re: Generation of Table of contents and index page

Post by Manohar_1024 »

Hello Dan,

I have succeeded in getting Index list at the end of the manual as per our requirement, thanks to you.
But is there anyway that the indexlist can be placed in after 1 chapter and can that also behave like a chapter.
So like I want to get chapter 2 as index list.

Thank you,
Manohar.


Dan wrote: Mon Apr 08, 2019 3:30 pm It is not clear, you succeeded in having a TOC and Index?
If not, please read below:

The index section collects all the index terms from the publication and shows them in a sorted tree.
To add index to your publication, you just need to add index terms to the topics metadata:

Code: Select all

  <title>The topic title.</title>
  <prolog>
    <metadata>
      <keywords>
        <indexterm>Installing <indexterm>Water Pump</indexterm></indexterm>
      </keywords>
    </metadata>
  </prolog>
  <body>
    .....
or in the content itself:

Code: Select all

...
<p>Open the lid then turn the body pump to the right. 
<indexterm>Installing <indexterm>Water Pump</indexterm></indexterm> 
</p>
...
In case you are using a bookmap, you need to specify where the index list should be presented, for instance in the backmatter of the book. This is done by using an indexlist element in the booklists if the backmatter:

Code: Select all

<bookmap>
    ...
    <chapter href="tasks/troubleshooting.dita">
	...
    </chapter>
    <backmatter>
        <booklists>
            <indexlist/>
        </booklists>
    </backmatter>
</bookmap>
For plain maps, the index list is automatically added at the end of the publication, with no need to modify the map.

Also, for plain maps, the TOC is automatically generated.

For DITA Book Maps you will need to add a toc element in the booklist element from the frontmatter:

Code: Select all

<bookmap>
  ...
  <frontmatter>
    <booklists>
      <toc/>
      <figurelist/>
      <tablelist/>
    </booklists>
  </frontmatter>
  ...
  ...
Many regards,
Dan
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Generation of Table of contents and index page

Post by Dan »

No, unfortunately the index must be placed in either frontmatter or backmatter, and those elements cannot be placed between chapters.
I understand the first chapter plays a special role, is a kind of abstract. Why not placing in in the frontmatter, as an abstract?
If you need more information about the DITA information architecture, you could ask questions on the DITA-users list: https://dita-users.groups.io

Many regards,
Dan
Post Reply