1<?xml version='1.0'?>
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<xsl:template match="set" mode="outline">
15  <xsl:variable name="id">
16    <xsl:call-template name="object.id"/>
17  </xsl:variable>
18
19  <fox:outline internal-destination="{$id}">
20    <fox:label>
21    <xsl:apply-templates select="." mode="label.markup"/>
22    <xsl:apply-templates select="." mode="title.markup"/>
23    </fox:label>
24
25  <xsl:if test="book">
26      <xsl:apply-templates select="book"
27                           mode="outline"/>
28  </xsl:if>
29  </fox:outline>
30</xsl:template>
31
32<xsl:template match="book" mode="outline">
33  <xsl:variable name="id">
34    <xsl:call-template name="object.id"/>
35  </xsl:variable>
36
37  <fox:outline internal-destination="{$id}">
38    <fox:label>
39    <xsl:apply-templates select="." mode="label.markup"/>
40    <xsl:apply-templates select="." mode="title.markup"/>
41    </fox:label>
42
43  <xsl:if test="part|preface|chapter|appendix">
44      <xsl:apply-templates select="part|preface|chapter|appendix"
45                           mode="outline"/>
46  </xsl:if>
47  </fox:outline>
48</xsl:template>
49
50
51<xsl:template match="part" mode="outline">
52  <xsl:variable name="id">
53    <xsl:call-template name="object.id"/>
54  </xsl:variable>
55
56  <fox:outline internal-destination="{$id}">
57    <fox:label>
58    <xsl:apply-templates select="." mode="label.markup"/>
59    <xsl:apply-templates select="." mode="title.markup"/>
60    </fox:label>
61
62  <xsl:if test="chapter|appendix|preface|reference">
63      <xsl:apply-templates select="chapter|appendix|preface|reference"
64                           mode="outline"/>
65  </xsl:if>
66  </fox:outline>
67</xsl:template>
68
69<xsl:template match="preface|chapter|appendix"
70              mode="outline">
71  <xsl:variable name="id">
72    <xsl:call-template name="object.id"/>
73  </xsl:variable>
74
75  <fox:outline internal-destination="{$id}">
76    <fox:label>
77    <xsl:apply-templates select="." mode="label.markup"/>
78    <xsl:apply-templates select="." mode="title.markup"/>
79    </fox:label>
80
81  <xsl:if test="section|sect1">
82      <xsl:apply-templates select="section|sect1"
83                           mode="outline"/>
84  </xsl:if>
85  </fox:outline>
86</xsl:template>
87
88<xsl:template match="section|sect1|sect2|sect3|sect4|sect5"
89              mode="outline">
90  <xsl:variable name="id">
91    <xsl:call-template name="object.id"/>
92  </xsl:variable>
93
94  <fox:outline internal-destination="{$id}">
95    <fox:label>
96    <xsl:apply-templates select="." mode="label.markup"/>
97    <xsl:apply-templates select="." mode="title.markup"/>
98    </fox:label>
99
100  <xsl:if test="section|sect2|sect3|sect4|sect5">
101      <xsl:apply-templates select="section|sect2|sect3|sect4|sect5"
102                           mode="outline"/>
103  </xsl:if>
104  </fox:outline>
105</xsl:template>
106
107<xsl:template match="bibliography|glossary|index"
108              mode="outline">
109  <xsl:variable name="id">
110    <xsl:call-template name="object.id"/>
111  </xsl:variable>
112
113  <fox:outline internal-destination="{$id}">
114    <fox:label>
115    <xsl:apply-templates select="." mode="label.markup"/>
116    <xsl:apply-templates select="." mode="title.markup"/>
117    </fox:label>
118  </fox:outline>
119</xsl:template>
120
121<xsl:template match="title" mode="outline">
122  <xsl:apply-templates/>
123</xsl:template>
124
125</xsl:stylesheet>
126
127