annotate src/bzip2-1.0.6/bz-fo.xsl @ 83:ae30d91d2ffe

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