- From: G. Ken Holman <gkholman@CraneSoftwrights.com>
- Date: Wed, 12 Mar 2003 10:03:28 -0500
- To: <www-xsl-fo@w3.org>
At 2003-03-12 01:53 +0800, The Crystal wrote:
>I havent been able to find a solution to link the listed chapters in my
>Table of Contents to the specific chapters later on in the book. Is there
>a way to do so?
>
> <fo:flow flow-name="xsl-region-body">
>
> <fo:block break-after="page" font-size="19pt">
> Table of Contents
><fo:block space-after="7pt"></fo:block>
> <fo:block text-indent="25pt" font-size="11pt" line-height="20pt">
> <xsl:for-each select="book/chapter">
At this point introduce a link surrounding the title to the generated id
for the chapter:
<fo:basic-link ref-id="{generate-id(.)}">
> <xsl:value-of select="title"/>
</fo:basic-link>
><fo:block></fo:block>
> </xsl:for-each>
> </fo:block>
> </fo:block>
>
> <xsl:apply-templates select="book"/>
> <xsl:apply-templates select="chapter"/>
> </fo:flow>
In your template rule for the chapter, create the anchor:
<xsl:template match="chapter">
<block id="{generate-id(.)}"/>
...
This resolves the referenced id from the basic link. Because XSLT's
generate-id() always produces the same value for the same node in a single
run of the stylesheet (not between different runs of the stylesheet) you
can use them at different times in the stylesheet to produce both ends of
the link.
I hope this helps.
................... Ken
--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
North America: June 16-20, 2003
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
Received on Wednesday, 12 March 2003 10:03:52 UTC