XSL:FO Table of content aligning page numbe to right margin???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jean-François Michaud

    XSL:FO Table of content aligning page numbe to right margin???

    Hello people,

    I'm having a hard time figuring out how to align my page numbe properly
    to the right margin in the Table of content I'm generating. I'm using
    FOP and there are some known issues regarding inline/inline-containers
    that use the text-align="justify" attribute value. It seems to plain
    not work at all in my case. I tried many things and I would like to
    avoid mustering esoteric alignments manually. Here is a snippet of what
    I'm trying to fix.

    The loop simply iterates on the nodes, outputs a titletext and a
    fetches the page number where the corresponding section/subsection or
    subsubsection is situated in the document. The code works fine, I just
    want to be able to align the page number right. I also need to generate
    dots between the title and the page number like so:

    1. SECTION 1 . . . . . . . . . . . . . . . . . . 8
    2. SECTIONBLAHBLAH . . . . . . . . . . 18

    Here is the snippet:

    <fo:list-block>
    <xsl:for-each select="//Body-SB/*">
    <fo:list-item>
    <fo:list-item-label end-indent="label-end()">
    <fo:block>
    <xsl:number count="child::* " format="1."/>
    </fo:block>
    </fo:list-item-label>
    <fo:list-item-body start-indent="body-start()">
    <fo:block text-align="justify" >
    <xsl:value-of select="@titlet ext" />
    <fo:page-number-citation ref-id="page.{name( )}"
    line-height="0" />
    </fo:block>
    <fo:block>
    <xsl:call-template name="Table Of Content Subsections"/>
    </fo:block>
    </fo:list-item-body>
    </fo:list-item>
    </xsl:for-each>
    </fo:list-block>
    </xsl:template>

    <xsl:template name="Table Of Content Subsections">
    <fo:list-block>
    <xsl:for-each select="./*">
    <fo:list-item>
    <fo:list-item-label end-indent="label-end()">
    <fo:block>
    <xsl:number count="child::* " format="A."/>
    </fo:block>
    </fo:list-item-label>
    <fo:list-item-body start-indent="body-start()">
    <fo:block>
    <xsl:value-of select="@titlet ext" />
    <fo:page-number-citation ref-id="page.{name( )}"
    line-height="0" />
    <xsl:call-template name="Table Of Content
    Subsubsections"/>
    </fo:block>
    </fo:list-item-body>
    </fo:list-item>
    </xsl:for-each>
    </fo:list-block>
    </xsl:template>

    <xsl:template name="Table Of Content Subsubsections" >
    <xsl:if test="name()='P-Eff' or name()='P-Refs' or
    name()='M-Parts'">
    <fo:list-block>
    <xsl:for-each select="./*">
    <fo:list-item>
    <fo:list-item-label end-indent="label-end()">
    <fo:block>
    <xsl:number count="child::* " format="1."/>
    </fo:block>
    </fo:list-item-label>
    <fo:list-item-body start-indent="body-start()">
    <fo:block>
    <xsl:value-of select="@titlet ext" />
    <fo:page-number-citation ref-id="page.{name( )}"
    line-height="0" />
    </fo:block>
    </fo:list-item-body>
    </fo:list-item>
    </xsl:for-each>
    </fo:list-block>
    </xsl:if>
    </xsl:template>

    How should I go about doing this? Any thoughts?

    Thanks
    Jean-Francois Michaud

Working...