2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:rx="http://www.renderx.com/XSL/Extensions"
7 <!-- ********************************************************************
8 $Id: xep.xsl 9838 2014-01-07 21:36:28Z bobstayton $
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="(//author|//editor|//corpauthor|//authorgroup)[1]"/>
23 <xsl:if test="$authors">
24 <xsl:variable name="author">
26 <xsl:when test="$authors[self::authorgroup]">
27 <xsl:call-template name="person.name.list">
28 <xsl:with-param name="person.list"
29 select="$authors/*[self::author|self::corpauthor|
30 self::othercredit|self::editor]"/>
33 <xsl:when test="$authors[self::corpauthor]">
34 <xsl:value-of select="$authors"/>
36 <xsl:when test="$authors[orgname]">
37 <xsl:value-of select="$authors/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="//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="//keyword">
81 <xsl:value-of select="normalize-space(.)"/>
82 <xsl:if test="position() != last()">
83 <xsl:text>, </xsl:text>
90 <xsl:if test="//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="//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="set|book|part|reference|preface|chapter|appendix|article
115 |glossary|bibliography|index|setindex|topic
116 |refentry|refsynopsisdiv
117 |refsect1|refsect2|refsect3|refsection
118 |sect1|sect2|sect3|sect4|sect5|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::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 set|book|part|reference|section|sect1|refentry
161 |article|topic|bibliography|glossary|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"/>