Pages: 1
Print
Author Topic: adding an entry for the index in the table of content of PDF output  (Read 2631 times)
IF
Member

Posts: 80


« on: October 13, 2010, 04:02:17 PM »

Has anyone tried to modify toc.xsl so that an entry with page number for the index appears in the table of contents of a PDF output?

This is for XMetal Author 6.0
Output is XMetal Enhanced PDF with Render XEP

Thanks - Isabelle
Logged
IF
Member

Posts: 80


« Reply #1 on: November 25, 2010, 11:32:58 AM »


Fyi - this is how I implemented this
 
<xsl:template name="createToc">
        <xsl:variable name="toc">
            <xsl:apply-templates select="/" mode="toc"/>
        </xsl:variable>
         
         <xsl:if test="count(exsl:node-set($toc)/*) > 0">
            <fo:page-sequence master-reference="toc-sequence" format="1" xsl:use-attribute-sets="__force__page__count">   
               <xsl:call-template name="insertTocStaticContents"/>
                <fo:flow flow-name="xsl-region-body">
                    <xsl:call-template name="createTocHeader"/>
                    <fo:block>
                        <xsl:copy-of select="exsl:node-set($toc)"/> 
                          <xsl:if test="(//opentopic-index:index.groups//opentopic-index:index.entry) and (count($index-entries//opentopic-index:index.entry) &gt; 0) ">
                            <xsl:call-template name="createIndexEntryToc"/> 
                          </xsl:if>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </xsl:if>
    </xsl:template>
   
    <xsl:template name="createIndexEntryToc">   
      <fo:basic-link internal-destination="ID_INDEX_00-0F-EA-40-0D-4D" xsl:use-attribute-sets="__toc__link">
          <fo:block xsl:use-attribute-sets="__toc__indent">
                <fo:block xsl:use-attribute-sets="__toc__index__content">     
                    <fo:inline xsl:use-attribute-sets="__toc__title" margin-right=".2in" keep-together.within-line="always">
                      <xsl:call-template name="insertVariable">
                        <xsl:with-param name="theVariableID" select="'Index'"/>
                      </xsl:call-template>
                    </fo:inline>
                    <fo:inline margin-left="-.2in" keep-together.within-line="always">
                      <fo:leader xsl:use-attribute-sets="__toc__leader"/>
                        <fo:page-number-citation  ref-id="ID_INDEX_00-0F-EA-40-0D-4D"/>
                    </fo:inline>
                </fo:block>
             </fo:block>
          </fo:basic-link>
      </xsl:template>

     <xsl:attribute-set name="__toc__index__content" use-attribute-sets="__toc__topic__content">
        <xsl:attribute name="font-size">14pt</xsl:attribute>
        <xsl:attribute name="font-weight">bold</xsl:attribute>
        <xsl:attribute name="padding-top">12pt</xsl:attribute>
    </xsl:attribute-set>
Logged
Pages: 1
Print
Jump to: