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 9293 2012-04-19 18:42:11Z 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}">
134 <xsl:value-of select="normalize-space($bookmark-label)"/>
136 <xsl:apply-templates select="*" mode="xep.outline"/>
140 <xsl:if test="$bookmark-label != ''">
141 <rx:bookmark internal-destination="{$id}">
143 <xsl:value-of select="normalize-space($bookmark-label)"/>
148 <xsl:variable name="toc.params">
149 <xsl:call-template name="find.path.params">
150 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
153 <xsl:if test="contains($toc.params, 'toc')
154 and set|book|part|reference|section|sect1|refentry
155 |article|topic|bibliography|glossary|chapter
157 <rx:bookmark internal-destination="toc...{$id}">
159 <xsl:call-template name="gentext">
160 <xsl:with-param name="key" select="'TableofContents'"/>
165 <xsl:apply-templates select="*" mode="xep.outline"/>
170 <xsl:template name="xep-pis">
171 <xsl:if test="$crop.marks != 0">
172 <xsl:processing-instruction name="xep-pdf-crop-mark-width"><xsl:value-of select="$crop.mark.width"/></xsl:processing-instruction>
173 <xsl:processing-instruction name="xep-pdf-crop-offset"><xsl:value-of select="$crop.mark.offset"/></xsl:processing-instruction>
174 <xsl:processing-instruction name="xep-pdf-bleed"><xsl:value-of select="$crop.mark.bleed"/></xsl:processing-instruction>
177 <xsl:call-template name="user-xep-pis"/>
180 <!-- Placeholder for user defined PIs -->
181 <xsl:template name="user-xep-pis"/>