1 <?xml version='1.0' encoding="utf-8"?>
2 <xsl:stylesheet exclude-result-prefixes="d"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:d="http://docbook.org/ns/docbook"
5 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6 xmlns:fox="http://xml.apache.org/fop/extensions"
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="d:set|d:book|d:part|d:reference|d:preface|d:chapter|d:appendix|d:article
36 |d:glossary|d:bibliography|d:index|d:setindex
38 |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d: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::d: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 (d:book|d:part|d:reference|d:preface|d:chapter|d:appendix|d:article
75 |d:glossary|d:bibliography|d:index|d:setindex
77 |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d: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}"/>