[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

TOC generation in XSL-FO -- U1/U2 = H1/H2

  • From: Matthias Fischer <m.fischer@a...>
  • To: Xml-Dev-List <xml-dev@l...>
  • Date: Fri, 07 Sep 2001 17:08:30 +0200

xsl fo toc
Hello friends,

sorry, it might seem a rather silly question to you, but I have problems to
create a TOC with XSL-FO. I couldn't find any good, exhaustive and at the
same time practical German-language XSL-documentation, therefore I am using
the W3C stuff. Neither did I find on amazon.com English-language literature
that did inspire me. Is there something in English you could recommend me?

At present, I've got the problem that I can't find any clear reference on
the creation of TOCs in FO. Therefore, what I've done is to specifiy inside
the fo:root element (outside seems not to work at all) as follows:

	<xsl:template match="FLATFIX">


		<!-- create table of contents -->
		<xsl:apply-templates select="H1" mode="toc"/>
			<xsl:apply-templates select="H2" mode="toc"/>
			<!-- do the document -->
			<xsl:apply-templates mode="toc"/>
		<xsl:apply-templates mode="toc"/>

(H2 is, like in HTML, not a part of H1, but follows it somewhere in the
Outside the root node I've put:

<!--   T O C   -->

<xsl:template match="H1" mode="toc">
<fo:basic-link internal-destination="{generate-id(.)}">
	<fo:block space-after="6.0pt" space-before="12.0pt"
			text-align="left" keep-with-next="true">
		<fo:inline font-family="Helvetica"
				font-size="11pt" font-weight="bold">
			<xsl:apply-templates mode="toc"/>

<xsl:template match="H2" mode="toc">
<fo:basic-link internal-destination="{generate-id(.)}">
	<fo:block space-after="8.0pt" space-before="10.0pt"
			text-align="left" start-indent="10.0mm">
		<fo:inline font-family="Helvetica"
				font-size="10pt" font-weight="bold">
			<xsl:apply-templates mode="toc"/>

<!--   H E A D I N G S   -->

<xsl:template match="H1">
	<fo:block id="{generate-id(.)}" space-after="12.0pt"
			space-before="16.0pt" text-align="left"
		<fo:inline font-family="Helvetica" font-size="18pt"

<xsl:template match="H2">
	<fo:block id="{generate-id(.)}" space-after="10.0pt"
			space-before="12.0pt" text-align="left"
		<fo:inline font-family="Helvetica" font-size="16pt" font-weight="bold">

If you don't consider my question too stupid, could you please put me onto
the right track? Thanks.



Dott. Matthias Fischer
abc.Mediaservice GmbH

Nebelhornstra├če 8
86807 Buchloe
Tel. (08241) 9686-38
Fax  (08241) 9686-26
e-mail: m.fischer@a...

ein Unternehmen der abc.Mediengruppe


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.