annotate src/bzip2-1.0.6/bz-fo.xsl @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 8a15ff55d9af
children
rev   line source
cannam@89 1 <?xml version="1.0" encoding="UTF-8"?> <!-- -*- sgml -*- -->
cannam@89 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
cannam@89 3 xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
cannam@89 4
cannam@89 5 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
cannam@89 6 <xsl:import href="bz-common.xsl"/>
cannam@89 7
cannam@89 8 <!-- set indent = yes while debugging, then change to NO -->
cannam@89 9 <xsl:output method="xml" indent="yes"/>
cannam@89 10
cannam@89 11 <!-- ensure only passivetex extensions are on -->
cannam@89 12 <xsl:param name="stylesheet.result.type" select="'fo'"/>
cannam@89 13 <!-- fo extensions: PDF bookmarks and index terms -->
cannam@89 14 <xsl:param name="use.extensions" select="'1'"/>
cannam@89 15 <xsl:param name="xep.extensions" select="0"/>
cannam@89 16 <xsl:param name="fop.extensions" select="0"/>
cannam@89 17 <xsl:param name="saxon.extensions" select="0"/>
cannam@89 18 <xsl:param name="passivetex.extensions" select="1"/>
cannam@89 19 <xsl:param name="tablecolumns.extension" select="'1'"/>
cannam@89 20
cannam@89 21 <!-- ensure we are using single sided -->
cannam@89 22 <xsl:param name="double.sided" select="'0'"/>
cannam@89 23
cannam@89 24 <!-- insert cross references to page numbers -->
cannam@89 25 <xsl:param name="insert.xref.page.number" select="1"/>
cannam@89 26
cannam@89 27 <!-- <?custom-pagebreak?> inserts a page break at this point -->
cannam@89 28 <xsl:template match="processing-instruction('custom-pagebreak')">
cannam@89 29 <fo:block break-before='page'/>
cannam@89 30 </xsl:template>
cannam@89 31
cannam@89 32 <!-- show links in color -->
cannam@89 33 <xsl:attribute-set name="xref.properties">
cannam@89 34 <xsl:attribute name="color">blue</xsl:attribute>
cannam@89 35 </xsl:attribute-set>
cannam@89 36
cannam@89 37 <!-- make pre listings indented a bit + a bg colour -->
cannam@89 38 <xsl:template match="programlisting | screen">
cannam@89 39 <fo:block start-indent="0.25in" wrap-option="no-wrap"
cannam@89 40 white-space-collapse="false" text-align="start"
cannam@89 41 font-family="monospace" background-color="#f2f2f9"
cannam@89 42 linefeed-treatment="preserve"
cannam@89 43 xsl:use-attribute-sets="normal.para.spacing">
cannam@89 44 <xsl:apply-templates/>
cannam@89 45 </fo:block>
cannam@89 46 </xsl:template>
cannam@89 47 <!-- make verbatim output prettier -->
cannam@89 48 <xsl:template match="literallayout">
cannam@89 49 <fo:block start-indent="0.25in" wrap-option="no-wrap"
cannam@89 50 white-space-collapse="false" text-align="start"
cannam@89 51 font-family="monospace" background-color="#edf7f4"
cannam@89 52 linefeed-treatment="preserve"
cannam@89 53 space-before="0em" space-after="0em">
cannam@89 54 <xsl:apply-templates/>
cannam@89 55 </fo:block>
cannam@89 56 </xsl:template>
cannam@89 57
cannam@89 58 <!-- workaround bug in passivetex fo output for itemizedlist -->
cannam@89 59 <xsl:template match="itemizedlist/listitem">
cannam@89 60 <xsl:variable name="id">
cannam@89 61 <xsl:call-template name="object.id"/></xsl:variable>
cannam@89 62 <xsl:variable name="itemsymbol">
cannam@89 63 <xsl:call-template name="list.itemsymbol">
cannam@89 64 <xsl:with-param name="node" select="parent::itemizedlist"/>
cannam@89 65 </xsl:call-template>
cannam@89 66 </xsl:variable>
cannam@89 67 <xsl:variable name="item.contents">
cannam@89 68 <fo:list-item-label end-indent="label-end()">
cannam@89 69 <fo:block>
cannam@89 70 <xsl:choose>
cannam@89 71 <xsl:when test="$itemsymbol='disc'">&#x2022;</xsl:when>
cannam@89 72 <xsl:when test="$itemsymbol='bullet'">&#x2022;</xsl:when>
cannam@89 73 <xsl:otherwise>&#x2022;</xsl:otherwise>
cannam@89 74 </xsl:choose>
cannam@89 75 </fo:block>
cannam@89 76 </fo:list-item-label>
cannam@89 77 <fo:list-item-body start-indent="body-start()">
cannam@89 78 <xsl:apply-templates/> <!-- removed extra block wrapper -->
cannam@89 79 </fo:list-item-body>
cannam@89 80 </xsl:variable>
cannam@89 81 <xsl:choose>
cannam@89 82 <xsl:when test="parent::*/@spacing = 'compact'">
cannam@89 83 <fo:list-item id="{$id}"
cannam@89 84 xsl:use-attribute-sets="compact.list.item.spacing">
cannam@89 85 <xsl:copy-of select="$item.contents"/>
cannam@89 86 </fo:list-item>
cannam@89 87 </xsl:when>
cannam@89 88 <xsl:otherwise>
cannam@89 89 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
cannam@89 90 <xsl:copy-of select="$item.contents"/>
cannam@89 91 </fo:list-item>
cannam@89 92 </xsl:otherwise>
cannam@89 93 </xsl:choose>
cannam@89 94 </xsl:template>
cannam@89 95
cannam@89 96 <!-- workaround bug in passivetex fo output for orderedlist -->
cannam@89 97 <xsl:template match="orderedlist/listitem">
cannam@89 98 <xsl:variable name="id">
cannam@89 99 <xsl:call-template name="object.id"/></xsl:variable>
cannam@89 100 <xsl:variable name="item.contents">
cannam@89 101 <fo:list-item-label end-indent="label-end()">
cannam@89 102 <fo:block>
cannam@89 103 <xsl:apply-templates select="." mode="item-number"/>
cannam@89 104 </fo:block>
cannam@89 105 </fo:list-item-label>
cannam@89 106 <fo:list-item-body start-indent="body-start()">
cannam@89 107 <xsl:apply-templates/> <!-- removed extra block wrapper -->
cannam@89 108 </fo:list-item-body>
cannam@89 109 </xsl:variable>
cannam@89 110 <xsl:choose>
cannam@89 111 <xsl:when test="parent::*/@spacing = 'compact'">
cannam@89 112 <fo:list-item id="{$id}"
cannam@89 113 xsl:use-attribute-sets="compact.list.item.spacing">
cannam@89 114 <xsl:copy-of select="$item.contents"/>
cannam@89 115 </fo:list-item>
cannam@89 116 </xsl:when>
cannam@89 117 <xsl:otherwise>
cannam@89 118 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
cannam@89 119 <xsl:copy-of select="$item.contents"/>
cannam@89 120 </fo:list-item>
cannam@89 121 </xsl:otherwise>
cannam@89 122 </xsl:choose>
cannam@89 123 </xsl:template>
cannam@89 124
cannam@89 125 <!-- workaround bug in passivetex fo output for variablelist -->
cannam@89 126 <xsl:param name="variablelist.as.blocks" select="1"/>
cannam@89 127 <xsl:template match="varlistentry" mode="vl.as.blocks">
cannam@89 128 <xsl:variable name="id">
cannam@89 129 <xsl:call-template name="object.id"/></xsl:variable>
cannam@89 130 <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
cannam@89 131 keep-together.within-column="always"
cannam@89 132 keep-with-next.within-column="always">
cannam@89 133 <xsl:apply-templates select="term"/>
cannam@89 134 </fo:block>
cannam@89 135 <fo:block start-indent="0.5in" end-indent="0in"
cannam@89 136 space-after.minimum="0.2em"
cannam@89 137 space-after.optimum="0.4em"
cannam@89 138 space-after.maximum="0.6em">
cannam@89 139 <fo:block>
cannam@89 140 <xsl:apply-templates select="listitem"/>
cannam@89 141 </fo:block>
cannam@89 142 </fo:block>
cannam@89 143 </xsl:template>
cannam@89 144
cannam@89 145
cannam@89 146 <!-- workaround bug in footers: force right-align w/two 80|30 cols -->
cannam@89 147 <xsl:template name="footer.table">
cannam@89 148 <xsl:param name="pageclass" select="''"/>
cannam@89 149 <xsl:param name="sequence" select="''"/>
cannam@89 150 <xsl:param name="gentext-key" select="''"/>
cannam@89 151 <xsl:choose>
cannam@89 152 <xsl:when test="$pageclass = 'index'">
cannam@89 153 <xsl:attribute name="margin-left">0pt</xsl:attribute>
cannam@89 154 </xsl:when>
cannam@89 155 </xsl:choose>
cannam@89 156 <xsl:variable name="candidate">
cannam@89 157 <fo:table table-layout="fixed" width="100%">
cannam@89 158 <fo:table-column column-number="1" column-width="80%"/>
cannam@89 159 <fo:table-column column-number="2" column-width="20%"/>
cannam@89 160 <fo:table-body>
cannam@89 161 <fo:table-row height="14pt">
cannam@89 162 <fo:table-cell text-align="left" display-align="after">
cannam@89 163 <xsl:attribute name="relative-align">baseline</xsl:attribute>
cannam@89 164 <fo:block>
cannam@89 165 <fo:block> </fo:block><!-- empty cell -->
cannam@89 166 </fo:block>
cannam@89 167 </fo:table-cell>
cannam@89 168 <fo:table-cell text-align="center" display-align="after">
cannam@89 169 <xsl:attribute name="relative-align">baseline</xsl:attribute>
cannam@89 170 <fo:block>
cannam@89 171 <xsl:call-template name="footer.content">
cannam@89 172 <xsl:with-param name="pageclass" select="$pageclass"/>
cannam@89 173 <xsl:with-param name="sequence" select="$sequence"/>
cannam@89 174 <xsl:with-param name="position" select="'center'"/>
cannam@89 175 <xsl:with-param name="gentext-key" select="$gentext-key"/>
cannam@89 176 </xsl:call-template>
cannam@89 177 </fo:block>
cannam@89 178 </fo:table-cell>
cannam@89 179 </fo:table-row>
cannam@89 180 </fo:table-body>
cannam@89 181 </fo:table>
cannam@89 182 </xsl:variable>
cannam@89 183 <!-- Really output a footer? -->
cannam@89 184 <xsl:choose>
cannam@89 185 <xsl:when test="$pageclass='titlepage' and $gentext-key='book'
cannam@89 186 and $sequence='first'">
cannam@89 187 <!-- no, book titlepages have no footers at all -->
cannam@89 188 </xsl:when>
cannam@89 189 <xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
cannam@89 190 <!-- no output -->
cannam@89 191 </xsl:when>
cannam@89 192 <xsl:otherwise>
cannam@89 193 <xsl:copy-of select="$candidate"/>
cannam@89 194 </xsl:otherwise>
cannam@89 195 </xsl:choose>
cannam@89 196 </xsl:template>
cannam@89 197
cannam@89 198
cannam@89 199 <!-- fix bug in headers: force right-align w/two 40|60 cols -->
cannam@89 200 <xsl:template name="header.table">
cannam@89 201 <xsl:param name="pageclass" select="''"/>
cannam@89 202 <xsl:param name="sequence" select="''"/>
cannam@89 203 <xsl:param name="gentext-key" select="''"/>
cannam@89 204 <xsl:choose>
cannam@89 205 <xsl:when test="$pageclass = 'index'">
cannam@89 206 <xsl:attribute name="margin-left">0pt</xsl:attribute>
cannam@89 207 </xsl:when>
cannam@89 208 </xsl:choose>
cannam@89 209 <xsl:variable name="candidate">
cannam@89 210 <fo:table table-layout="fixed" width="100%">
cannam@89 211 <xsl:call-template name="head.sep.rule">
cannam@89 212 <xsl:with-param name="pageclass" select="$pageclass"/>
cannam@89 213 <xsl:with-param name="sequence" select="$sequence"/>
cannam@89 214 <xsl:with-param name="gentext-key" select="$gentext-key"/>
cannam@89 215 </xsl:call-template>
cannam@89 216 <fo:table-column column-number="1" column-width="40%"/>
cannam@89 217 <fo:table-column column-number="2" column-width="60%"/>
cannam@89 218 <fo:table-body>
cannam@89 219 <fo:table-row height="14pt">
cannam@89 220 <fo:table-cell text-align="left" display-align="before">
cannam@89 221 <xsl:attribute name="relative-align">baseline</xsl:attribute>
cannam@89 222 <fo:block>
cannam@89 223 <fo:block> </fo:block><!-- empty cell -->
cannam@89 224 </fo:block>
cannam@89 225 </fo:table-cell>
cannam@89 226 <fo:table-cell text-align="center" display-align="before">
cannam@89 227 <xsl:attribute name="relative-align">baseline</xsl:attribute>
cannam@89 228 <fo:block>
cannam@89 229 <xsl:call-template name="header.content">
cannam@89 230 <xsl:with-param name="pageclass" select="$pageclass"/>
cannam@89 231 <xsl:with-param name="sequence" select="$sequence"/>
cannam@89 232 <xsl:with-param name="position" select="'center'"/>
cannam@89 233 <xsl:with-param name="gentext-key" select="$gentext-key"/>
cannam@89 234 </xsl:call-template>
cannam@89 235 </fo:block>
cannam@89 236 </fo:table-cell>
cannam@89 237 </fo:table-row>
cannam@89 238 </fo:table-body>
cannam@89 239 </fo:table>
cannam@89 240 </xsl:variable>
cannam@89 241 <!-- Really output a header? -->
cannam@89 242 <xsl:choose>
cannam@89 243 <xsl:when test="$pageclass = 'titlepage' and $gentext-key = 'book'
cannam@89 244 and $sequence='first'">
cannam@89 245 <!-- no, book titlepages have no headers at all -->
cannam@89 246 </xsl:when>
cannam@89 247 <xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
cannam@89 248 <!-- no output -->
cannam@89 249 </xsl:when>
cannam@89 250 <xsl:otherwise>
cannam@89 251 <xsl:copy-of select="$candidate"/>
cannam@89 252 </xsl:otherwise>
cannam@89 253 </xsl:choose>
cannam@89 254 </xsl:template>
cannam@89 255
cannam@89 256
cannam@89 257 <!-- Bug-fix for Suse 10 PassiveTex version -->
cannam@89 258 <!-- Precompute attribute values 'cos PassiveTex is too stupid: -->
cannam@89 259 <xsl:attribute-set name="component.title.properties">
cannam@89 260 <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
cannam@89 261 <xsl:attribute name="space-before.optimum">
cannam@89 262 <xsl:value-of select="concat($body.font.master, 'pt')"/>
cannam@89 263 </xsl:attribute>
cannam@89 264 <xsl:attribute name="space-before.minimum">
cannam@89 265 <xsl:value-of select="$body.font.master * 0.8"/>
cannam@89 266 <xsl:text>pt</xsl:text>
cannam@89 267 </xsl:attribute>
cannam@89 268 <xsl:attribute name="space-before.maximum">
cannam@89 269 <xsl:value-of select="$body.font.master * 1.2"/>
cannam@89 270 <xsl:text>pt</xsl:text>
cannam@89 271 </xsl:attribute>
cannam@89 272 <xsl:attribute name="hyphenate">false</xsl:attribute>
cannam@89 273 </xsl:attribute-set>
cannam@89 274
cannam@89 275
cannam@89 276 </xsl:stylesheet>