1 | <?xml version='1.0'?>
|
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
3 | xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
|
---|
4 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
5 | version='1.0'>
|
---|
6 |
|
---|
7 | <!-- ********************************************************************
|
---|
8 | $Id: fop1.xsl 9293 2012-04-19 18:42:11Z bobstayton $
|
---|
9 | ********************************************************************
|
---|
10 |
|
---|
11 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
12 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
13 | copyright and other information.
|
---|
14 |
|
---|
15 | ******************************************************************** -->
|
---|
16 |
|
---|
17 | <!-- ==================================================================== -->
|
---|
18 |
|
---|
19 | <xsl:variable name="bookmarks.state">
|
---|
20 | <xsl:choose>
|
---|
21 | <xsl:when test="$bookmarks.collapse != 0">hide</xsl:when>
|
---|
22 | <xsl:otherwise>show</xsl:otherwise>
|
---|
23 | </xsl:choose>
|
---|
24 | </xsl:variable>
|
---|
25 |
|
---|
26 | <xsl:template match="*" mode="fop1.outline">
|
---|
27 | <xsl:apply-templates select="*" mode="fop1.outline"/>
|
---|
28 | </xsl:template>
|
---|
29 |
|
---|
30 | <xsl:template match="set|book|part|reference|
|
---|
31 | preface|chapter|appendix|article|topic
|
---|
32 | |glossary|bibliography|index|setindex
|
---|
33 | |refentry
|
---|
34 | |sect1|sect2|sect3|sect4|sect5|section"
|
---|
35 | mode="fop1.outline">
|
---|
36 |
|
---|
37 | <xsl:variable name="id">
|
---|
38 | <xsl:call-template name="object.id"/>
|
---|
39 | </xsl:variable>
|
---|
40 | <xsl:variable name="bookmark-label">
|
---|
41 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
42 | </xsl:variable>
|
---|
43 |
|
---|
44 | <!-- Put the root element bookmark at the same level as its children -->
|
---|
45 | <!-- If the object is a set or book, generate a bookmark for the toc -->
|
---|
46 |
|
---|
47 | <xsl:choose>
|
---|
48 | <xsl:when test="self::index and $generate.index = 0"/>
|
---|
49 | <xsl:when test="parent::*">
|
---|
50 | <fo:bookmark internal-destination="{$id}">
|
---|
51 | <xsl:attribute name="starting-state">
|
---|
52 | <xsl:value-of select="$bookmarks.state"/>
|
---|
53 | </xsl:attribute>
|
---|
54 | <fo:bookmark-title>
|
---|
55 | <xsl:value-of select="normalize-space($bookmark-label)"/>
|
---|
56 | </fo:bookmark-title>
|
---|
57 | <xsl:apply-templates select="*" mode="fop1.outline"/>
|
---|
58 | </fo:bookmark>
|
---|
59 | </xsl:when>
|
---|
60 | <xsl:otherwise>
|
---|
61 | <fo:bookmark internal-destination="{$id}">
|
---|
62 | <xsl:attribute name="starting-state">
|
---|
63 | <xsl:value-of select="$bookmarks.state"/>
|
---|
64 | </xsl:attribute>
|
---|
65 | <fo:bookmark-title>
|
---|
66 | <xsl:value-of select="normalize-space($bookmark-label)"/>
|
---|
67 | </fo:bookmark-title>
|
---|
68 | </fo:bookmark>
|
---|
69 |
|
---|
70 | <xsl:variable name="toc.params">
|
---|
71 | <xsl:call-template name="find.path.params">
|
---|
72 | <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
|
---|
73 | </xsl:call-template>
|
---|
74 | </xsl:variable>
|
---|
75 |
|
---|
76 | <xsl:if test="contains($toc.params, 'toc')
|
---|
77 | and (book|part|reference|preface|chapter|appendix|article|topic
|
---|
78 | |glossary|bibliography|index|setindex
|
---|
79 | |refentry
|
---|
80 | |sect1|sect2|sect3|sect4|sect5|section)">
|
---|
81 | <fo:bookmark internal-destination="toc...{$id}">
|
---|
82 | <fo:bookmark-title>
|
---|
83 | <xsl:call-template name="gentext">
|
---|
84 | <xsl:with-param name="key" select="'TableofContents'"/>
|
---|
85 | </xsl:call-template>
|
---|
86 | </fo:bookmark-title>
|
---|
87 | </fo:bookmark>
|
---|
88 | </xsl:if>
|
---|
89 | <xsl:apply-templates select="*" mode="fop1.outline"/>
|
---|
90 | </xsl:otherwise>
|
---|
91 | </xsl:choose>
|
---|
92 | <!--
|
---|
93 | <fo:bookmark internal-destination="{$id}"/>
|
---|
94 | -->
|
---|
95 | </xsl:template>
|
---|
96 |
|
---|
97 | <xsl:template match="*" mode="fop1.foxdest">
|
---|
98 | <xsl:apply-templates select="*" mode="fop1.foxdest"/>
|
---|
99 | </xsl:template>
|
---|
100 |
|
---|
101 | <xsl:template match="set|book|part|reference|
|
---|
102 | preface|chapter|appendix|article|topic
|
---|
103 | |glossary|bibliography|index|setindex
|
---|
104 | |refentry
|
---|
105 | |sect1|sect2|sect3|sect4|sect5|section"
|
---|
106 | mode="fop1.foxdest">
|
---|
107 | <xsl:variable name="id">
|
---|
108 | <xsl:call-template name="object.id"/>
|
---|
109 | </xsl:variable>
|
---|
110 | <xsl:variable name="bookmark-label">
|
---|
111 | <xsl:apply-templates select="." mode="object.title.markup"/>
|
---|
112 | </xsl:variable>
|
---|
113 | <!--xsl:if test="$id != ''">
|
---|
114 | <fox:destination internal-destination="{$id}"/>
|
---|
115 | </xsl:if-->
|
---|
116 |
|
---|
117 | <!-- Put the root element bookmark at the same level as its children -->
|
---|
118 | <!-- If the object is a set or book, generate a bookmark for the toc -->
|
---|
119 |
|
---|
120 | <xsl:choose>
|
---|
121 | <xsl:when test="self::index and $generate.index = 0"/>
|
---|
122 | <xsl:when test="parent::*">
|
---|
123 | <fox:destination internal-destination="{$id}"/>
|
---|
124 | <xsl:apply-templates select="*" mode="fop1.foxdest"/>
|
---|
125 | </xsl:when>
|
---|
126 | <xsl:otherwise>
|
---|
127 | <fox:destination internal-destination="{$id}"/>
|
---|
128 | <xsl:apply-templates select="*" mode="fop1.foxdest"/>
|
---|
129 | </xsl:otherwise>
|
---|
130 | </xsl:choose>
|
---|
131 | </xsl:template>
|
---|
132 | <!-- Metadata support ("Document Properties" in Adobe Reader) -->
|
---|
133 | <xsl:template name="fop1-document-information">
|
---|
134 | <xsl:variable name="authors" select="(//author|//editor|//corpauthor|//authorgroup)[1]"/>
|
---|
135 |
|
---|
136 | <xsl:variable name="title">
|
---|
137 | <xsl:apply-templates select="/*[1]" mode="label.markup"/>
|
---|
138 | <xsl:apply-templates select="/*[1]" mode="title.markup"/>
|
---|
139 | <xsl:variable name="subtitle">
|
---|
140 | <xsl:apply-templates select="/*[1]" mode="subtitle.markup">
|
---|
141 | <xsl:with-param name="verbose" select="0"/>
|
---|
142 | </xsl:apply-templates>
|
---|
143 | </xsl:variable>
|
---|
144 | <xsl:if test="$subtitle !=''">
|
---|
145 | <xsl:text> - </xsl:text>
|
---|
146 | <xsl:value-of select="$subtitle"/>
|
---|
147 | </xsl:if>
|
---|
148 | </xsl:variable>
|
---|
149 |
|
---|
150 | <fo:declarations>
|
---|
151 | <x:xmpmeta xmlns:x="adobe:ns:meta/">
|
---|
152 | <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
---|
153 | <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
---|
154 | <!-- Dublin Core properties go here -->
|
---|
155 |
|
---|
156 | <!-- Title -->
|
---|
157 | <dc:title><xsl:value-of select="normalize-space($title)"/></dc:title>
|
---|
158 |
|
---|
159 | <!-- Author -->
|
---|
160 | <xsl:if test="$authors">
|
---|
161 | <xsl:variable name="author">
|
---|
162 | <xsl:choose>
|
---|
163 | <xsl:when test="$authors[self::authorgroup]">
|
---|
164 | <xsl:call-template name="person.name.list">
|
---|
165 | <xsl:with-param name="person.list"
|
---|
166 | select="$authors/*[self::author|self::corpauthor|
|
---|
167 | self::othercredit|self::editor]"/>
|
---|
168 | </xsl:call-template>
|
---|
169 | </xsl:when>
|
---|
170 | <xsl:when test="$authors[self::corpauthor]">
|
---|
171 | <xsl:value-of select="$authors"/>
|
---|
172 | </xsl:when>
|
---|
173 | <xsl:when test="$authors[orgname]">
|
---|
174 | <xsl:value-of select="$authors/orgname"/>
|
---|
175 | </xsl:when>
|
---|
176 | <xsl:otherwise>
|
---|
177 | <xsl:call-template name="person.name">
|
---|
178 | <xsl:with-param name="node" select="$authors"/>
|
---|
179 | </xsl:call-template>
|
---|
180 | </xsl:otherwise>
|
---|
181 | </xsl:choose>
|
---|
182 | </xsl:variable>
|
---|
183 |
|
---|
184 | <dc:creator><xsl:value-of select="normalize-space($author)"/></dc:creator>
|
---|
185 | </xsl:if>
|
---|
186 |
|
---|
187 | <!-- Subject -->
|
---|
188 | <xsl:if test="//subjectterm">
|
---|
189 | <dc:description>
|
---|
190 | <xsl:for-each select="//subjectterm">
|
---|
191 | <xsl:value-of select="normalize-space(.)"/>
|
---|
192 | <xsl:if test="position() != last()">
|
---|
193 | <xsl:text>, </xsl:text>
|
---|
194 | </xsl:if>
|
---|
195 | </xsl:for-each>
|
---|
196 | </dc:description>
|
---|
197 | </xsl:if>
|
---|
198 | </rdf:Description>
|
---|
199 |
|
---|
200 | <rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
|
---|
201 | <!-- PDF properties go here -->
|
---|
202 |
|
---|
203 | <!-- Keywords -->
|
---|
204 | <xsl:if test="//keyword">
|
---|
205 | <pdf:Keywords>
|
---|
206 | <xsl:for-each select="//keyword">
|
---|
207 | <xsl:value-of select="normalize-space(.)"/>
|
---|
208 | <xsl:if test="position() != last()">
|
---|
209 | <xsl:text>, </xsl:text>
|
---|
210 | </xsl:if>
|
---|
211 | </xsl:for-each>
|
---|
212 | </pdf:Keywords>
|
---|
213 | </xsl:if>
|
---|
214 | </rdf:Description>
|
---|
215 |
|
---|
216 | <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
|
---|
217 | <!-- XMP properties go here -->
|
---|
218 |
|
---|
219 | <!-- Creator Tool -->
|
---|
220 | <xmp:CreatorTool>DocBook XSL Stylesheets with Apache FOP</xmp:CreatorTool>
|
---|
221 | </rdf:Description>
|
---|
222 |
|
---|
223 | </rdf:RDF>
|
---|
224 | </x:xmpmeta>
|
---|
225 | </fo:declarations>
|
---|
226 | </xsl:template>
|
---|
227 |
|
---|
228 | </xsl:stylesheet>
|
---|