OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@abc-media.de

ein Unternehmen der abc.Mediengruppe