[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">
	<fo:root>

		...

		<!-- 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"/>
	</fo:root>
 	</xsl:template>

(H2 is, like in HTML, not a part of H1, but follows it somewhere in the
document...)
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"/>
		</fo:inline>
	</fo:block>
</fo:basic-link>
</xsl:template>

<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"/>
		</fo:inline>
	</fo:block>
</fo:basic-link>
</xsl:template>


<!--   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"
			keep-with-next="true">
		<fo:inline font-family="Helvetica" font-size="18pt"
				font-weight="bold">
			<xsl:apply-templates/>
		</fo:inline>
	</fo:block>
</xsl:template>

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


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

Regards

Matthias

____________________________________
Dott. Matthias Fischer
abc.Mediaservice GmbH

Nebelhornstra├če 8
86807 Buchloe
Tel. (08241) 9686-38
Fax  (08241) 9686-26
http://www.abc-media.de
e-mail: m.fischer@a...

ein Unternehmen der abc.Mediengruppe




PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.