[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Section numbers and titles in PDF indexes
Hi, This can be done, but it somewhat depends on which XSL-FO processor you are using. If you are using XEP, then it is a little more complicated because XEP has indexing extensions that collapse duplicate page numbers and ranges, and the Docbook stylesheets make use of those extensions when when the stylesheet parameter xep.extensions=1. If you are not using XEP, you can customize this template from fo/autoidx.xsl: <xsl:template match="indexterm" mode="reference"> Where you see: <fo:page-number-citation ref-id="{$id}"/> you can replace it with code to generate the section title. The $id here is the generated id for the indexterm, used in the marker element, which is an empty fo element placed as the point destination for the indexterm in the body of the document. So this id won't be used for the section text. To generate a text string like "3.4 Product Range", you'll need to find the appropriate ancestor element of the indexterm. The same template in html/autoidx.xsl has the code for that. It uses a text entity §ion; which is defined in common/entities.ent (you'll need to include those entity declarations at the top of your customization layer in the same way html/autoidx.xsl does). Then you can generate the number and title with: <xsl:variable name="container" select="§ion;"/> <xsl:apply-templates select="$container" mode="label.markup"/> <xsl:text> </xsl:text> <xsl:apply-templates select="$container" mode="title.markup"/> Bob Stayton Sagehill Enterprises bobs@sagehill.net ----- Original Message ----- From: "Andrew McFarland" <aamcfarland@gmail.com> To: <docbook-apps@lists.oasis-open.org> Sent: Thursday, August 27, 2009 8:28 AM Subject: [docbook-apps] Section numbers and titles in PDF indexes > I'd like to have a PDF index with section numbers and section titles > in the index instead of page numbers. > > E.g instead of > > widgets .......... 54 > > Have > > widgets........3.4 Product Range > > Is this possible? I can't see any easy way to do this. I looked at the > HTML index template, and only got confused. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]