You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by grom nospam <gr...@yahoo.com.au> on 2009/06/02 04:12:15 UTC
Table of Contents
I am currently using fo:list-block to format my Table of Contents, but this means I can only make the fo:list-item-body part be a link (with fo:basic-link). A line in the Table of Contents is formatted as so:
1.0 Introduction..........1
Is there an alternative to formatting the items as such?
Below is snippet of my current xsl stylesheet:
<xsl:template match="document" mode="contents">
<fo:list-block provisional-label-separation="0cm" provisional-distance-between-starts="1.02cm">
<xsl:apply-templates select="sect1" mode="contents"/>
</fo:list-block>
<fo:block break-after="page"/>
</xsl:template>
<xsl:template match="sect1" mode="contents">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<xsl:number format="1"/>.0
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block text-align="left" text-align-last="justify">
<fo:basic-link internal-destination="{generate-id(.)}">
<xsl:value-of select="h"/>
<fo:leader leader-pattern="dots"/>
<fo:page-number-citation ref-id="{generate-id(.)}"/>
</fo:basic-link>
</fo:block>
<xsl:if test="count(sect2) > 0">
<fo:list-block provisional-label-separation="0cm" provisional-distance-between-starts="1.02cm">
<xsl:apply-templates select="sect2" mode="contents"/>
</fo:list-block>
</xsl:if>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
I did try but the width on the inline did not apply:
<fo:block text-align="left" text-align-last="justify">
<fo:basic-link internal-destination="{generate-id(.)}">
<fo:inline width="1.02cm"><xsl:number format="1"/>.0</fo:inline>
<xsl:value-of select="h"/>
<fo:leader leader-pattern="dots"/>
<fo:page-number-citation ref-id="{generate-id(.)}"/>
</fo:basic-link>
</fo:block>
Need a Holiday? Win a $10,000 Holiday of your choice. Enter now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Table of Contents
Posted by Pascal SANCHO <pa...@takoma.fr>.
grom nospam a écrit :
> I am currently using fo:list-block to format my Table of Contents, but this means I can only make the fo:list-item-body part be a link (with fo:basic-link). A line in the Table of Contents is formatted as so:
> 1.0 Introduction..........1
>
> Is there an alternative to formatting the items as such?
>
> Below is snippet of my current xsl stylesheet:
> <xsl:template match="document" mode="contents">
> <fo:list-block provisional-label-separation="0cm" provisional-distance-between-starts="1.02cm">
> <xsl:apply-templates select="sect1" mode="contents"/>
> </fo:list-block>
> <fo:block break-after="page"/>
> </xsl:template>
>
> <xsl:template match="sect1" mode="contents">
> <fo:list-item>
> <fo:list-item-label end-indent="label-end()">
> <fo:block>
> <xsl:number format="1"/>.0
> </fo:block>
> </fo:list-item-label>
> <fo:list-item-body start-indent="body-start()">
> <fo:block text-align="left" text-align-last="justify">
> <fo:basic-link internal-destination="{generate-id(.)}">
> <xsl:value-of select="h"/>
> <fo:leader leader-pattern="dots"/>
> <fo:page-number-citation ref-id="{generate-id(.)}"/>
> </fo:basic-link>
> </fo:block>
> <xsl:if test="count(sect2) > 0">
> <fo:list-block provisional-label-separation="0cm" provisional-distance-between-starts="1.02cm">
> <xsl:apply-templates select="sect2" mode="contents"/>
> </fo:list-block>
> </xsl:if>
> </fo:list-item-body>
> </fo:list-item>
> </xsl:template>
>
> I did try but the width on the inline did not apply:
> <fo:block text-align="left" text-align-last="justify">
> <fo:basic-link internal-destination="{generate-id(.)}">
> <fo:inline width="1.02cm"><xsl:number format="1"/>.0</fo:inline>
> <xsl:value-of select="h"/>
> <fo:leader leader-pattern="dots"/>
> <fo:page-number-citation ref-id="{generate-id(.)}"/>
> </fo:basic-link>
> </fo:block>
Hi,
what you need here is an fo:inline-container, witch is currently not
supported by FOP.
As a workaround, you can try 2 options:
- either add a 2nd fo:basic-link around the section number
- or, assuming digits have same width in the used font, add a
padding-right property to your fo:inline
HTH,
Pascal
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org