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 7531 2007-10-17 18:06:49Z dcramer $
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"/>
37 <xsl:call-template name="person.name">
38 <xsl:with-param name="node" select="$authors"/>
43 <xsl:element name="rx:meta-field">
44 <xsl:attribute name="name">author</xsl:attribute>
45 <xsl:attribute name="value">
46 <xsl:value-of select="normalize-space($author)"/>
51 <xsl:variable name="title">
52 <xsl:apply-templates select="/*[1]" mode="label.markup"/>
53 <xsl:apply-templates select="/*[1]" mode="title.markup"/>
56 <xsl:element name="rx:meta-field">
57 <xsl:attribute name="name">creator</xsl:attribute>
58 <xsl:attribute name="value">
59 <xsl:text>DocBook </xsl:text>
60 <xsl:value-of select="$DistroTitle"/>
61 <xsl:text> V</xsl:text>
62 <xsl:value-of select="$VERSION"/>
66 <xsl:element name="rx:meta-field">
67 <xsl:attribute name="name">title</xsl:attribute>
68 <xsl:attribute name="value">
69 <xsl:value-of select="normalize-space($title)"/>
73 <xsl:if test="//keyword">
74 <xsl:element name="rx:meta-field">
75 <xsl:attribute name="name">keywords</xsl:attribute>
76 <xsl:attribute name="value">
77 <xsl:for-each select="//keyword">
78 <xsl:value-of select="normalize-space(.)"/>
79 <xsl:if test="position() != last()">
80 <xsl:text>, </xsl:text>
87 <xsl:if test="//subjectterm">
88 <xsl:element name="rx:meta-field">
89 <xsl:attribute name="name">subject</xsl:attribute>
90 <xsl:attribute name="value">
91 <xsl:for-each select="//subjectterm">
92 <xsl:value-of select="normalize-space(.)"/>
93 <xsl:if test="position() != last()">
94 <xsl:text>, </xsl:text>
103 <!-- ********************************************************************
105 ******************************************************************** -->
107 <xsl:template match="*" mode="xep.outline">
108 <xsl:apply-templates select="*" mode="xep.outline"/>
111 <xsl:template match="set|book|part|reference|preface|chapter|appendix|article
112 |glossary|bibliography|index|setindex
113 |refentry|refsynopsisdiv
114 |refsect1|refsect2|refsect3|refsection
115 |sect1|sect2|sect3|sect4|sect5|section"
117 <xsl:variable name="id">
118 <xsl:call-template name="object.id"/>
120 <xsl:variable name="bookmark-label">
121 <xsl:apply-templates select="." mode="object.title.markup"/>
124 <!-- Put the root element bookmark at the same level as its children -->
125 <!-- If the object is a set or book, generate a bookmark for the toc -->
127 <xsl:when test="self::index and $generate.index = 0"/>
128 <xsl:when test="parent::*">
129 <rx:bookmark internal-destination="{$id}">
131 <xsl:value-of select="normalize-space($bookmark-label)"/>
133 <xsl:apply-templates select="*" mode="xep.outline"/>
137 <xsl:if test="$bookmark-label != ''">
138 <rx:bookmark internal-destination="{$id}">
140 <xsl:value-of select="normalize-space($bookmark-label)"/>
145 <xsl:variable name="toc.params">
146 <xsl:call-template name="find.path.params">
147 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
150 <xsl:if test="contains($toc.params, 'toc')
151 and set|book|part|reference|section|sect1|refentry
152 |article|bibliography|glossary|chapter
154 <rx:bookmark internal-destination="toc...{$id}">
156 <xsl:call-template name="gentext">
157 <xsl:with-param name="key" select="'TableofContents'"/>
162 <xsl:apply-templates select="*" mode="xep.outline"/>
167 <xsl:template name="xep-pis">
168 <xsl:if test="$crop.marks != 0">
169 <xsl:processing-instruction name="xep-pdf-crop-mark-width"><xsl:value-of select="$crop.mark.width"/></xsl:processing-instruction>
170 <xsl:processing-instruction name="xep-pdf-crop-offset"><xsl:value-of select="$crop.mark.offset"/></xsl:processing-instruction>
171 <xsl:processing-instruction name="xep-pdf-bleed"><xsl:value-of select="$crop.mark.bleed"/></xsl:processing-instruction>
174 <xsl:call-template name="user-xep-pis"/>
177 <!-- Placeholder for user defined PIs -->
178 <xsl:template name="user-xep-pis"/>