Problem solved. I realized that when I added parts to a book, the
toc.indent.width value was doubled for the section entries - it's
cumulative. I found the right template that affects the toc.indent.width
for chapters, and needed to customize it for books both with and without
parts. Here is my code (with a new variable "toc.indent.width.sections"
expressed in points, which provides left margin for all section, sect1,
etc... titles):
<xsl:template match="d:preface|d:chapter|d:appendix|d:article"
mode="toc">
<xsl:param name="toc-context" select="."/>
...
<xsl:if test="$toc.section.depth > 0
and $toc.max.depth > $depth.from.context
and $nodes">
<xsl:choose>
<xsl:when test="parent::d:part">
<fo:block id="toc.{$cid}.{$id}"
margin-left="-{$toc.indent.width}pt+{$toc.indent.width.sections}pt">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block id="toc.{$cid}.{$id}"
margin-left="{$toc.indent.width.sections}pt">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
On 13-10-12 6:33 PM, Xmplar wrote:
>
> In a book toc, I need to set the first-level sections listed under
> each chapter against the left margin of the toc.
>
> The screenshot showing the sections listed under Chapter 2 is what I'm
> trying to achieve with a customization of toc.indent.width (I think
> that's what I need anyway).
>
> I used a single toc.indent.width value (29pt), and in the FO I changed
> the margin-left for the fo:block that has a chapter id number, to give
> it a negative value for toc.indent.width. The fo code is:
>
> <fo:blockid="toc.d0e1.chap2"margin-left="-29pt">
> <fo:basic-linkinternal-destination="sec2.1">
> <fo:list-block
> provisional-label-separation="1mm"provisional-distance-between-starts="10mm">
> <fo:list-item>
> <fo:list-item-labelend-indent="label-end()">
> <fo:block
>
> Setting the value of -29pt once for each chapter will set the left
> margin correctly for all section entries listed in each chapter.
>
> But how do I apply that margin-left value in the stylesheets? I tried
> modifying the relevant code in thetemplate
> <xsl:templatematch="d:book|d:setindex"mode="toc">.
>
> The fo:block in that template seems obvious, but that oddly didn't
> apply the left-margin to the FO:
>
> <fo:blockid="toc.{$cid}.{$id}" margin-left="-29pt">
> <xsl:attributename="margin-{$direction.align.start}">
> <xsl:call-templatename="set.toc.indent"/>
> </xsl:attribute>
>
> Thanks in advance!
>
> --
> *Dave Gardiner*
>