source: stylesheets/pdf/lfs-mixed.xsl@ ec0a37e6

6.0
Last change on this file since ec0a37e6 was ec0a37e6, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Added support to can force page breaks.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/testing/BOOK@4048 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.0 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 version="1.0">
6
7
8 <!-- This is a hack and isn't correct semantically. The beginpage tags must
9 be placed in the XML source only to render the final PDF output, and must
10 be removed after.-->
11 <xsl:template match="beginpage">
12 <fo:block break-after="page"/>
13 </xsl:template>
14
15 <!-- Split URLs -->
16 <xsl:template name="hyphenate-url">
17 <xsl:param name="url" select="''"/>
18 <xsl:choose>
19 <xsl:when test="ancestor::varlistentry">
20 <xsl:choose>
21 <xsl:when test="string-length($url) > 88">
22 <xsl:value-of select="substring($url, 1, 50)"/>
23 <xsl:param name="rest" select="substring($url, 51)"/>
24 <xsl:value-of select="substring-before($rest, '/')"/>
25 <xsl:text> /</xsl:text>
26 <xsl:value-of select="substring-after($rest, '/')"/>
27 </xsl:when>
28 <xsl:otherwise>
29 <xsl:value-of select="$url"/>
30 </xsl:otherwise>
31 </xsl:choose>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:value-of select="$url"/>
35 <!-- <xsl:value-of select="substring-before($url, '//')"/>
36 <xsl:text>// </xsl:text>
37 <xsl:call-template name="split-url">
38 <xsl:with-param name="url2" select="substring-after($url, '//')"/>
39 </xsl:call-template>-->
40 </xsl:otherwise>
41 </xsl:choose>
42 </xsl:template>
43
44 <!--<xsl:template name="split-url">
45 <xsl:choose>
46 <xsl:when test="contains($url2, '/')">
47 <xsl:param name="url2" select="''"/>
48 <xsl:value-of select="substring-before($url2, '/')"/>
49 <xsl:text> /</xsl:text>
50 <xsl:call-template name="split-url">
51 <xsl:with-param name="url2" select="substring-after($url2, '/')"/>
52 </xsl:call-template>
53 </xsl:when>
54 <xsl:otherwise>
55 <xsl:value-of select="$url2"/>
56 </xsl:otherwise>
57 </xsl:choose>
58 </xsl:template>-->
59
60 <!-- Shade screen -->
61 <xsl:param name="shade.verbatim" select="1"/>
62
63 <!-- Graphics in admonitions -->
64 <xsl:param name="admon.graphics" select="1"/>
65 <xsl:param name="admon.graphics.path"
66 select="'/usr/share/xml/docbook/xsl-stylesheets-1.65.1/images/'"/>
67
68 <!-- Admonition block properties -->
69 <xsl:template match="important|warning|caution">
70 <xsl:choose>
71 <xsl:when test="$admon.graphics != 0">
72 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
73 space-before.maximum="0.8em" border-style="solid" border-width="1pt"
74 border-color="#500" background-color="#FFFFE6">
75 <xsl:call-template name="graphical.admonition"/>
76 </fo:block>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:call-template name="nongraphical.admonition"/>
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:template>
83
84 <xsl:template match="note|tip">
85 <xsl:choose>
86 <xsl:when test="$admon.graphics != 0">
87 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
88 space-before.maximum="0.8em" border-style="solid" border-width="1pt"
89 border-color="#E0E0E0" background-color="#FFFFE6">
90 <xsl:call-template name="graphical.admonition"/>
91 </fo:block>
92 </xsl:when>
93 <xsl:otherwise>
94 <xsl:call-template name="nongraphical.admonition"/>
95 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:template>
98
99 <!-- Admonitions text properties -->
100 <xsl:attribute-set name="admonition.properties">
101 <xsl:attribute name="margin-right">6pt</xsl:attribute>
102 </xsl:attribute-set>
103
104 <!-- Adding left space to the graphics and color to the titles -->
105 <xsl:template name="graphical.admonition">
106 <xsl:variable name="id">
107 <xsl:call-template name="object.id"/>
108 </xsl:variable>
109 <xsl:variable name="graphic.width">
110 <xsl:call-template name="admon.graphic.width"/>
111 </xsl:variable>
112 <fo:block id="{$id}">
113 <fo:list-block provisional-distance-between-starts="{$graphic.width} + 18pt"
114 provisional-label-separation="18pt" xsl:use-attribute-sets="list.block.spacing">
115 <fo:list-item>
116 <fo:list-item-label end-indent="label-end()">
117 <fo:block margin-left="4pt">
118 <fo:external-graphic width="auto" height="auto"
119 content-width="{$graphic.width}" >
120 <xsl:attribute name="src">
121 <xsl:call-template name="admon.graphic"/>
122 </xsl:attribute>
123 </fo:external-graphic>
124 </fo:block>
125 </fo:list-item-label>
126 <fo:list-item-body start-indent="body-start()">
127 <xsl:if test="$admon.textlabel != 0 or title">
128 <fo:block xsl:use-attribute-sets="admonition.title.properties">
129 <xsl:if test="ancestor-or-self::important">
130 <xsl:attribute name="color">#500</xsl:attribute>
131 </xsl:if>
132 <xsl:if test="ancestor-or-self::warning">
133 <xsl:attribute name="color">#500</xsl:attribute>
134 </xsl:if>
135 <xsl:if test="ancestor-or-self::caution">
136 <xsl:attribute name="color">#500</xsl:attribute>
137 </xsl:if>
138 <xsl:apply-templates select="." mode="object.title.markup"/>
139 </fo:block>
140 </xsl:if>
141 <fo:block xsl:use-attribute-sets="admonition.properties">
142 <xsl:apply-templates/>
143 </fo:block>
144 </fo:list-item-body>
145 </fo:list-item>
146 </fo:list-block>
147 </fo:block>
148 </xsl:template>
149
150 <!-- How is rendered by default a variablelist -->
151 <xsl:param name="variablelist.as.blocks" select="1"/>
152 <xsl:param name="variablelist.max.termlength">32</xsl:param>
153
154 <!-- Adding space before segmentedlist -->
155 <xsl:template match="segmentedlist">
156 <!--<xsl:variable name="presentation">
157 <xsl:call-template name="pi-attribute">
158 <xsl:with-param name="pis"
159 select="processing-instruction('dbfo')"/>
160 <xsl:with-param name="attribute" select="'list-presentation'"/>
161 </xsl:call-template>
162 </xsl:variable>
163 <xsl:choose>
164 <xsl:when test="$presentation = 'table'">
165 <xsl:apply-templates select="." mode="seglist-table"/>
166 </xsl:when>
167 <xsl:when test="$presentation = 'list'">
168 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
169 space-before.maximum="0.8em">
170 <xsl:apply-templates/>
171 </fo:block>
172 </xsl:when>
173 <xsl:when test="$segmentedlist.as.table != 0">
174 <xsl:apply-templates select="." mode="seglist-table"/>
175 </xsl:when>
176 <xsl:otherwise>-->
177 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
178 space-before.maximum="0.8em">
179 <xsl:apply-templates/>
180 </fo:block>
181 <!--</xsl:otherwise>
182 </xsl:choose>-->
183 </xsl:template>
184
185</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.