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"
|
---|
5 | version='1.0'>
|
---|
6 |
|
---|
7 | <!-- ********************************************************************
|
---|
8 | $Id$
|
---|
9 | ********************************************************************
|
---|
10 | (c) Stephane Bline Peregrine Systems 2001
|
---|
11 | Driver file to allow pdf bookmarking (based on fop implementation).
|
---|
12 | ******************************************************************** -->
|
---|
13 | <!--
|
---|
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.
|
---|
16 |
|
---|
17 | Pavel Zampach (zampach@volny.cz)
|
---|
18 | -->
|
---|
19 |
|
---|
20 | <xsl:variable name="a-dia" select=
|
---|
21 | "'āăąćĉċčďđēĕėęěœĝğġģĥħĩīĭįıĵķĺļľŀłńņňŋōŏőŕŗřśŝşšţťŧũūŭůűųŵŷźżžĀĂĄĆĈĊČĎĐĒĔĖĘĚŒĜĞĠĢĤĦĨĪĬĮİĴĶĹĻĽĿŁŃŅŇŊŌŎŐŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽ'"/>
|
---|
22 | <xsl:variable name="a-asc" select=
|
---|
23 | "'aaaccccddeeeeeegggghhiiiiijklllllnnnnooorrrsssstttuuuuuuwyzzzAAACCCCDDEEEEEEGGGGHHIIIIIJKLLLLLNNNNOOORRRSSSSTTTUUUUUUWYYZZZ'"/>
|
---|
24 |
|
---|
25 | <xsl:template match="*" mode="fop.outline">
|
---|
26 | <xsl:variable name="id">
|
---|
27 | <xsl:value-of select="(@id|@xml:id)[1]"/>
|
---|
28 | </xsl:variable>
|
---|
29 | <xsl:if test="$id != ''">
|
---|
30 | <fox:destination internal-destination="{$id}"/>
|
---|
31 | </xsl:if>
|
---|
32 | <xsl:apply-templates select="*" mode="fop.outline"/>
|
---|
33 | </xsl:template>
|
---|
34 |
|
---|
35 | <xsl:template match="set|book|part|reference|preface|chapter|appendix|article
|
---|
36 | |glossary|bibliography|index|setindex
|
---|
37 | |refentry
|
---|
38 | |sect1|sect2|sect3|sect4|sect5|section"
|
---|
39 | mode="fop.outline">
|
---|
40 | <xsl:variable name="id">
|
---|
41 | <xsl:call-template name="object.id"/>
|
---|
42 | </xsl:variable>
|
---|
43 | <xsl:variable name="bookmark-label">
|
---|
44 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
45 | </xsl:variable>
|
---|
46 |
|
---|
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 -->
|
---|
49 |
|
---|
50 | <xsl:choose>
|
---|
51 | <xsl:when test="parent::*">
|
---|
52 | <fox:outline internal-destination="{$id}">
|
---|
53 | <fox:label>
|
---|
54 | <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
|
---|
55 | </fox:label>
|
---|
56 | <xsl:apply-templates select="*" mode="fop.outline"/>
|
---|
57 | </fox:outline>
|
---|
58 | </xsl:when>
|
---|
59 | <xsl:otherwise>
|
---|
60 | <fox:outline internal-destination="{$id}">
|
---|
61 | <fox:label>
|
---|
62 | <xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
|
---|
63 | </fox:label>
|
---|
64 | </fox:outline>
|
---|
65 |
|
---|
66 | <xsl:variable name="toc.params">
|
---|
67 | <xsl:call-template name="find.path.params">
|
---|
68 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
|
---|
69 | </xsl:call-template>
|
---|
70 | </xsl:variable>
|
---|
71 |
|
---|
72 | <xsl:if test="contains($toc.params, 'toc')
|
---|
73 | and (book|part|reference|preface|chapter|appendix|article
|
---|
74 | |glossary|bibliography|index|setindex
|
---|
75 | |refentry
|
---|
76 | |sect1|sect2|sect3|sect4|sect5|section)">
|
---|
77 | <fox:outline internal-destination="toc...{$id}">
|
---|
78 | <fox:label>
|
---|
79 | <xsl:call-template name="gentext">
|
---|
80 | <xsl:with-param name="key" select="'TableofContents'"/>
|
---|
81 | </xsl:call-template>
|
---|
82 | </fox:label>
|
---|
83 | </fox:outline>
|
---|
84 | </xsl:if>
|
---|
85 | <xsl:apply-templates select="*" mode="fop.outline"/>
|
---|
86 | </xsl:otherwise>
|
---|
87 | </xsl:choose>
|
---|
88 | <fox:destination internal-destination="{$id}"/>
|
---|
89 | </xsl:template>
|
---|
90 |
|
---|
91 | </xsl:stylesheet>
|
---|
92 |
|
---|