cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Add a text generated from the title of a chapter or section in the TOC

JordiGarcia
9-Granite

Add a text generated from the title of a chapter or section in the TOC

I have some titles that, through a condition, add a "NEW" image to indicate that this section is new.
When I do the TOC the image added in the condition with a generated text of type suffix does not appear.

How can I make it appear.

 

Example of how it appears in the document.

JordiGarcia_0-1611916397782.png

Example of how it appears in the TOC

JordiGarcia_1-1611916481567.png

Example of how I want it to appear

JordiGarcia_2-1611916542827.png

 

I use Docbook and Styler.

Thank you,

1 REPLY 1

Styler's dialogs can be a little limiting in this area but you should be able to do something here without diving into edited source.

1. Find which TOC definition you are using by selecting the <toc/> element

2. Go to that definition in Styler via the TOC tab e.g. in the OOTB Docbook stylesheet it is called "Book Table of Contents"

3. With the correct TOC definition selected, click "Customize Title Contexts..."

4. From the popup dialog, find the relevant context(s) in the list and use the "Add..." button to add additional content to the TOC entries for those context(s)

5. You should see a single Text entry <_gte:ElementContent/>, click the "Edit..." button next to that field

6. Now you are in an editor for the generated TOC content. You can add the words "NEW" and refresh the Editor window or PDF just to prove to yourself that the content is appearing in your TOC.

7. Next step is how do you control when you want the NEW content to appear? In the simplest case you can Insert -> XPath String... to do some simple XPath to calculate the NEW content

8. If that doesn't give you enough flexibility then you will need to insert a UFE instead (user formatting element) and then define that UFE using edited source feature to implement the NEW content condition check and insertion via coding e.g. in FOSI engine with FOSI coding or in APP engine with Javascript

Top Tags