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:rx="http://www.renderx.com/XSL/Extensions"
9 <!-- ********************************************************************
10 (c) Stephane Bline Peregrine Systems 2001
11 Implementation of xep extensions:
12 * Pdf bookmarks (based on the XEP 2.5 implementation)
13 * Document information (XEP 2.5 meta information extensions)
14 ******************************************************************** -->
16 <!-- FIXME: Norm, I changed things so that the top-level element (book or set)
17 does not appear in the TOC. Is this the right thing? -->
19 <xsl:template name="xep-document-information">
21 <xsl:variable name="authors"
22 select="(//d:author|//d:editor|//d:corpauthor|//d:authorgroup)[1]"/>
23 <xsl:if test="$authors">
24 <xsl:variable name="author">
26 <xsl:when test="$authors[self::d:authorgroup]">
27 <xsl:call-template name="person.name.list">
28 <xsl:with-param name="person.list"
29 select="$authors/*[self::d:author|self::d:corpauthor|
30 self::d:othercredit|self::d:editor]"/>
33 <xsl:when test="$authors[self::d:corpauthor]">
34 <xsl:value-of select="$authors"/>
36 <xsl:when test="$authors[d:orgname]">
37 <xsl:value-of select="$authors/d:orgname"/>
40 <xsl:call-template name="person.name">
41 <xsl:with-param name="node" select="$authors"/>
46 <xsl:element name="rx:meta-field">
47 <xsl:attribute name="name">author</xsl:attribute>
48 <xsl:attribute name="value">
49 <xsl:value-of select="normalize-space($author)"/>
54 <xsl:variable name="title">
55 <xsl:apply-templates select="/*[1]" mode="label.markup"/>
56 <xsl:apply-templates select="/*[1]" mode="title.markup"/>
59 <xsl:element name="rx:meta-field">
60 <xsl:attribute name="name">creator</xsl:attribute>
61 <xsl:attribute name="value">
62 <xsl:text>DocBook </xsl:text>
63 <xsl:value-of select="$DistroTitle"/>
64 <xsl:text> V</xsl:text>
65 <xsl:value-of select="$VERSION"/>
69 <xsl:element name="rx:meta-field">
70 <xsl:attribute name="name">title</xsl:attribute>
71 <xsl:attribute name="value">
72 <xsl:value-of select="normalize-space($title)"/>
76 <xsl:if test="//d:keyword">
77 <xsl:element name="rx:meta-field">
78 <xsl:attribute name="name">keywords</xsl:attribute>
79 <xsl:attribute name="value">
80 <xsl:for-each select="//d:keyword">
81 <xsl:value-of select="normalize-space(.)"/>
82 <xsl:if test="position() != last()">
83 <xsl:text>, </xsl:text>
90 <xsl:if test="//d:subjectterm">
91 <xsl:element name="rx:meta-field">
92 <xsl:attribute name="name">subject</xsl:attribute>
93 <xsl:attribute name="value">
94 <xsl:for-each select="//d:subjectterm">
95 <xsl:value-of select="normalize-space(.)"/>
96 <xsl:if test="position() != last()">
97 <xsl:text>, </xsl:text>
106 <!-- ********************************************************************
108 ******************************************************************** -->
110 <xsl:template match="*" mode="xep.outline">
111 <xsl:apply-templates select="*" mode="xep.outline"/>
114 <xsl:template match="d:set|d:book|d:part|d:reference|d:preface|d:chapter|d:appendix|d:article
115 |d:glossary|d:bibliography|d:index|d:setindex|d:topic
116 |d:refentry|d:refsynopsisdiv
117 |d:refsect1|d:refsect2|d:refsect3|d:refsection
118 |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5|d:section"
120 <xsl:variable name="id">
121 <xsl:call-template name="object.id"/>
123 <xsl:variable name="bookmark-label">
124 <xsl:apply-templates select="." mode="object.title.markup"/>
127 <!-- Put the root element bookmark at the same level as its children -->
128 <!-- If the object is a set or book, generate a bookmark for the toc -->
130 <xsl:when test="self::d:index and $generate.index = 0"/>
131 <xsl:when test="parent::*">
132 <rx:bookmark internal-destination="{$id}">
133 <xsl:attribute name="starting-state">
134 <xsl:value-of select="$bookmarks.state"/>
137 <xsl:value-of select="normalize-space($bookmark-label)"/>
139 <xsl:apply-templates select="*" mode="xep.outline"/>
143 <xsl:if test="$bookmark-label != ''">
144 <rx:bookmark internal-destination="{$id}">
145 <xsl:attribute name="starting-state">
146 <xsl:value-of select="$bookmarks.state"/>
149 <xsl:value-of select="normalize-space($bookmark-label)"/>
154 <xsl:variable name="toc.params">
155 <xsl:call-template name="find.path.params">
156 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
159 <xsl:if test="contains($toc.params, 'toc')
160 and d:set|d:book|d:part|d:reference|d:section|d:sect1|d:refentry
161 |d:article|d:topic|d:bibliography|d:glossary|d:chapter
163 <rx:bookmark internal-destination="toc...{$id}">
165 <xsl:call-template name="gentext">
166 <xsl:with-param name="key" select="'TableofContents'"/>
171 <xsl:apply-templates select="*" mode="xep.outline"/>
176 <xsl:template name="xep-pis">
177 <xsl:if test="$crop.marks != 0">
178 <xsl:processing-instruction name="xep-pdf-crop-mark-width"><xsl:value-of select="$crop.mark.width"/></xsl:processing-instruction>
179 <xsl:processing-instruction name="xep-pdf-crop-offset"><xsl:value-of select="$crop.mark.offset"/></xsl:processing-instruction>
180 <xsl:processing-instruction name="xep-pdf-bleed"><xsl:value-of select="$crop.mark.bleed"/></xsl:processing-instruction>
183 <xsl:call-template name="user-xep-pis"/>
186 <!-- Placeholder for user defined PIs -->
187 <xsl:template name="user-xep-pis"/>