Home Forums DITA and XMetaL Discussion How to add leading numbers in headings for PDF output? Reply To: How to add leading numbers in headings for PDF output?

Chris

Reply to: How to add leading numbers in headings for PDF output?

Hi Chartered,

To add numbering to topic titles, you will have to override two XSL templates from [xmfo]/xsl/fo/commons.xsl:

“processTopicTitle” from ~line 580, and “getTitle” from ~1220.

The “getTitle” override controls display in the body text and TOC, and “processTopicTitle” renders the link text for inline xrefs.

Copy both of these templates into your customization file: [xmfo]/Customization/fo/xsl/custom.xsl

1. For “getTitle”, add a variable called “level”:

Now you can use the value of “level” in the choose statement – add this just before the :


      count=”*[contains(@class, ' topic/topic ')]”
    level=”multiple”/>
 

2. For “processTopicTitle”, add a variable called “level” after the “element” variable:


 
   
 

Further down in the template, just before the element, modify the topic/title match:


 
 
   
 

 

This should get you started – you may have to tweak some of the xsl:number attributes (@from, @level, etc.) to get the exact numbering you're after.

HTH,

– Chris

Reply

Products
Downloads
Support