1 | <?xml version='1.0'?>
|
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
3 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
4 | xmlns="http://www.w3.org/1999/xhtml"
|
---|
5 | version="1.0">
|
---|
6 |
|
---|
7 | <!-- We use FO and FOP as the processor -->
|
---|
8 | <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.65.1/fo/docbook.xsl"/>
|
---|
9 | <xsl:param name="fop.extensions" select="1"/>
|
---|
10 | <xsl:param name="draft.mode" select="'no'"/>
|
---|
11 | <!-- Probably want to make the paper size configurable -->
|
---|
12 | <xsl:param name="paper.type" select="'A4'"/>
|
---|
13 |
|
---|
14 | <!-- Include our customised templates -->
|
---|
15 | <xsl:include href="pdf/lfs-index.xsl"/>
|
---|
16 |
|
---|
17 | <!-- Font size -->
|
---|
18 | <xsl:param name="body.font.master">8</xsl:param>
|
---|
19 | <xsl:param name="body.font.size">10pt</xsl:param>
|
---|
20 |
|
---|
21 | <!-- Margins -->
|
---|
22 | <xsl:param name="page.margin.inner">1in</xsl:param>
|
---|
23 | <xsl:param name="page.margin.outer">0.5in</xsl:param>
|
---|
24 | <xsl:param name="title.margin.left">-1pc</xsl:param>
|
---|
25 |
|
---|
26 | <!-- TOC stuff -->
|
---|
27 | <xsl:param name="generate.toc">
|
---|
28 | book toc
|
---|
29 | part nop
|
---|
30 | </xsl:param>
|
---|
31 | <xsl:param name="toc.section.depth">1</xsl:param>
|
---|
32 | <xsl:param name="generate.section.toc.level" select="-1"></xsl:param>
|
---|
33 | <xsl:param name="toc.indent.width" select="18"></xsl:param>
|
---|
34 |
|
---|
35 | <!-- Force section1's onto a new page -->
|
---|
36 | <xsl:attribute-set name="section.level1.properties">
|
---|
37 | <xsl:attribute name="break-after">page</xsl:attribute>
|
---|
38 | </xsl:attribute-set>
|
---|
39 |
|
---|
40 | <!-- Columns in appendix -->
|
---|
41 | <xsl:param name="column.count.back" select="2"/>
|
---|
42 |
|
---|
43 | <!-- Don't hyphenate -->
|
---|
44 | <xsl:param name="hyphenate">false</xsl:param>
|
---|
45 | <xsl:param name="alignment">left</xsl:param>
|
---|
46 |
|
---|
47 | <!-- Page number in Xref-->
|
---|
48 | <xsl:param name="insert.xref.page.number">yes</xsl:param>
|
---|
49 | <xsl:template match="xref" name="xref">
|
---|
50 | <xsl:variable name="targets" select="key('id',@linkend)"/>
|
---|
51 | <xsl:variable name="target" select="$targets[1]"/>
|
---|
52 | <xsl:variable name="refelem" select="local-name($target)"/>
|
---|
53 | <xsl:call-template name="check.id.unique">
|
---|
54 | <xsl:with-param name="linkend" select="@linkend"/>
|
---|
55 | </xsl:call-template>
|
---|
56 | <xsl:choose>
|
---|
57 | <xsl:when test="$refelem=''">
|
---|
58 | <xsl:message>
|
---|
59 | <xsl:text>XRef to nonexistent id: </xsl:text>
|
---|
60 | <xsl:value-of select="@linkend"/>
|
---|
61 | </xsl:message>
|
---|
62 | <xsl:text>???</xsl:text>
|
---|
63 | </xsl:when>
|
---|
64 | <xsl:when test="@endterm">
|
---|
65 | <fo:basic-link internal-destination="{@linkend}"
|
---|
66 | xsl:use-attribute-sets="xref.properties">
|
---|
67 | <xsl:variable name="etargets" select="key('id',@endterm)"/>
|
---|
68 | <xsl:variable name="etarget" select="$etargets[1]"/>
|
---|
69 | <xsl:choose>
|
---|
70 | <xsl:when test="count($etarget) = 0">
|
---|
71 | <xsl:message>
|
---|
72 | <xsl:value-of select="count($etargets)"/>
|
---|
73 | <xsl:text>Endterm points to nonexistent ID: </xsl:text>
|
---|
74 | <xsl:value-of select="@endterm"/>
|
---|
75 | </xsl:message>
|
---|
76 | <xsl:text>???</xsl:text>
|
---|
77 | </xsl:when>
|
---|
78 | <xsl:otherwise>
|
---|
79 | <xsl:apply-templates select="$etarget" mode="endterm"/>
|
---|
80 | </xsl:otherwise>
|
---|
81 | </xsl:choose>
|
---|
82 | </fo:basic-link>
|
---|
83 | </xsl:when>
|
---|
84 | <xsl:when test="$target/@xreflabel">
|
---|
85 | <fo:basic-link internal-destination="{@linkend}"
|
---|
86 | xsl:use-attribute-sets="xref.properties">
|
---|
87 | <xsl:call-template name="xref.xreflabel">
|
---|
88 | <xsl:with-param name="target" select="$target"/>
|
---|
89 | </xsl:call-template>
|
---|
90 | </fo:basic-link>
|
---|
91 | </xsl:when>
|
---|
92 | <xsl:otherwise>
|
---|
93 | <fo:basic-link internal-destination="{@linkend}"
|
---|
94 | xsl:use-attribute-sets="xref.properties">
|
---|
95 | <xsl:apply-templates select="$target" mode="xref-to">
|
---|
96 | <xsl:with-param name="referrer" select="."/>
|
---|
97 | <xsl:with-param name="xrefstyle">
|
---|
98 | <xsl:choose>
|
---|
99 | <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
|
---|
100 | <xsl:value-of select="@role"/>
|
---|
101 | </xsl:when>
|
---|
102 | <xsl:otherwise>
|
---|
103 | <xsl:value-of select="@xrefstyle"/>
|
---|
104 | </xsl:otherwise>
|
---|
105 | </xsl:choose>
|
---|
106 | </xsl:with-param>
|
---|
107 | </xsl:apply-templates>
|
---|
108 | </fo:basic-link>
|
---|
109 | </xsl:otherwise>
|
---|
110 | </xsl:choose>
|
---|
111 | <xsl:if test="not(starts-with(normalize-space(@xrefstyle), 'select:') != ''
|
---|
112 | and (contains(@xrefstyle, 'page')
|
---|
113 | or contains(@xrefstyle, 'Page')))
|
---|
114 | and ( $insert.xref.page.number = 'yes'
|
---|
115 | or $insert.xref.page.number = '1')
|
---|
116 | or local-name($target) = 'para'">
|
---|
117 | <fo:basic-link internal-destination="{@linkend}"
|
---|
118 | xsl:use-attribute-sets="xref.properties">
|
---|
119 | <xsl:text>, p. </xsl:text>
|
---|
120 | <xsl:apply-templates select="$target" mode="page.citation">
|
---|
121 | <xsl:with-param name="id" select="@linkend"/>
|
---|
122 | </xsl:apply-templates>
|
---|
123 | </fo:basic-link>
|
---|
124 | </xsl:if>
|
---|
125 | </xsl:template>
|
---|
126 |
|
---|
127 | <!-- Prevent duplicate e-mails in the Acknowledgments pages-->
|
---|
128 | <xsl:param name="ulink.show" select="0"/>
|
---|
129 |
|
---|
130 | </xsl:stylesheet>
|
---|