Change Mini TOC level in PDF (XSL:FO/FOP) #4116
-
|
Hi, I use a mini TOC (yellow highlight). This is generated with the template Test files: toc-levels.zip Update 1: Update 2: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The solution is to adjust the XPath of the following template. This line ... <xsl:apply-templates select="*[contains(@class, ' topic/topic ')]" mode="in-this-chapter-list"/>... has to be changed to ... <xsl:apply-templates select="descendant::*[contains(@class, ' topic/topic ')]" mode="in-this-chapter-list"/>. The full template now looks like this: <xsl:template match="*" mode="createMiniToc">
<fo:table xsl:use-attribute-sets="__toc__mini__table">
<fo:table-column xsl:use-attribute-sets="__toc__mini__table__column_1"/>
<fo:table-column xsl:use-attribute-sets="__toc__mini__table__column_2"/>
<fo:table-body xsl:use-attribute-sets="__toc__mini__table__body">
<fo:table-row>
<fo:table-cell>
<fo:block xsl:use-attribute-sets="__toc__mini">
<xsl:if test="*[contains(@class, ' topic/topic ')]">
<fo:block xsl:use-attribute-sets="__toc__mini__header">
<xsl:call-template name="getVariable">
<xsl:with-param name="id" select="'Mini Toc'"/>
</xsl:call-template>
</fo:block>
<fo:list-block xsl:use-attribute-sets="__toc__mini__list">
<xsl:apply-templates select="*[contains(@class, ' topic/topic ')]" mode="in-this-chapter-list"/>
</fo:list-block>
</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="__toc__mini__summary">
<!--Really, it would be better to just apply-templates, but the attribute sets for shortdesc, body
and abstract might indent the text. Here, the topic body is in a table cell, and should
not be indented, so each element is handled specially.-->
<fo:block>
<xsl:apply-templates select="*[contains(@class, ' topic/titlealts ')]"/>
<xsl:if test="
*[contains(@class, ' topic/shortdesc ')
or contains(@class, ' topic/abstract ')]/node()">
<fo:block xsl:use-attribute-sets="p">
<xsl:apply-templates select="
*[contains(@class, ' topic/shortdesc ')
or contains(@class, ' topic/abstract ')]/node()"/>
</fo:block>
</xsl:if>
<xsl:apply-templates select="*[contains(@class, ' topic/body ')]/*"/>
<xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]"/>
<xsl:if test="
*[contains(@class, ' topic/related-links ')]//
*[contains(@class, ' topic/link ')][not(@role) or @role != 'child']">
<xsl:apply-templates select="*[contains(@class, ' topic/related-links ')]"/>
</xsl:if>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template> |
Beta Was this translation helpful? Give feedback.

The solution is to adjust the XPath of the following template.
This line ...
... has to be changed to ...
. The full template now looks like this: