1 <?xml version='1.0' encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:fox="http://xml.apache.org/fop/extensions"
7 <!-- ********************************************************************
8 $Id: fop.xsl 7531 2007-10-17 18:06:49Z dcramer $
9 ********************************************************************
10 (c) Stephane Bline Peregrine Systems 2001
11 Driver file to allow pdf bookmarking (based on fop implementation).
12 ******************************************************************** -->
14 In PDF bookmarks can't be used characters with code>255. This version of file
15 translates characters with code>255 back to ASCII.
17 Pavel Zampach (zampach@volny.cz)
20 <xsl:variable name="a-dia" select=
21 "'āăąćĉċčďđēĕėęěœĝğġģĥħĩīĭįıĵķĺļľŀłńņňŋōŏőŕŗřśŝşšţťŧũūŭůűųŵŷźżžĀĂĄĆĈĊČĎĐĒĔĖĘĚŒĜĞĠĢĤĦĨĪĬĮİĴĶĹĻĽĿŁŃŅŇŊŌŎŐŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽ'"/>
22 <xsl:variable name="a-asc" select=
23 "'aaaccccddeeeeeegggghhiiiiijklllllnnnnooorrrsssstttuuuuuuwyzzzAAACCCCDDEEEEEEGGGGHHIIIIIJKLLLLLNNNNOOORRRSSSSTTTUUUUUUWYYZZZ'"/>
25 <xsl:template match="*" mode="fop.outline">
26 <xsl:variable name="id">
27 <xsl:value-of select="(@id|@xml:id)[1]"/>
29 <xsl:if test="$id != ''">
30 <fox:destination internal-destination="{$id}"/>
32 <xsl:apply-templates select="*" mode="fop.outline"/>
35 <xsl:template match="set|book|part|reference|preface|chapter|appendix|article
36 |glossary|bibliography|index|setindex
38 |sect1|sect2|sect3|sect4|sect5|section"
40 <xsl:variable name="id">
41 <xsl:call-template name="object.id"/>
43 <xsl:variable name="bookmark-label">
44 <xsl:apply-templates select="." mode="object.title.markup"/>
47 <!-- Put the root element bookmark at the same level as its children -->
48 <!-- If the object is a set or book, generate a bookmark for the toc -->
51 <xsl:when test="self::index and $generate.index = 0"/>
52 <xsl:when test="parent::*">
53 <fox:outline internal-destination="{$id}">
55 <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
57 <xsl:apply-templates select="*" mode="fop.outline"/>
61 <fox:outline internal-destination="{$id}">
63 <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
67 <xsl:variable name="toc.params">
68 <xsl:call-template name="find.path.params">
69 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
73 <xsl:if test="contains($toc.params, 'toc')
74 and (book|part|reference|preface|chapter|appendix|article
75 |glossary|bibliography|index|setindex
77 |sect1|sect2|sect3|sect4|sect5|section)">
78 <fox:outline internal-destination="toc...{$id}">
80 <xsl:call-template name="gentext">
81 <xsl:with-param name="key" select="'TableofContents'"/>
86 <xsl:apply-templates select="*" mode="fop.outline"/>
89 <fox:destination internal-destination="{$id}"/>