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 version='1.0'> 5 6<!-- ******************************************************************** 7 $Id$ 8 ******************************************************************** 9 10 This file is part of the XSL DocBook Stylesheet distribution. 11 See /README or http://nwalsh.com/docbook/xsl/ for copyright 12 and other information. 13 14 ******************************************************************** --> 15 16<!-- ==================================================================== --> 17 18<xsl:variable name="glossterm-width">2in</xsl:variable> 19<xsl:variable name="glossterm-sep">0.25in</xsl:variable> 20 21<!-- ==================================================================== --> 22 23<xsl:template match="glossary"> 24 <xsl:variable name="divs" select="glossdiv"/> 25 <xsl:variable name="entries" select="glossentry"/> 26 <xsl:variable name="preamble" 27 select="*[not(self::title 28 or self::subtitle 29 or self::glossdiv 30 or self::glossentry)]"/> 31 32 <xsl:variable name="id"> 33 <xsl:call-template name="object.id"/> 34 </xsl:variable> 35 36 <fo:block id="{$id}"> 37 <xsl:call-template name="component.separator"/> 38 39 <xsl:call-template name="glossary.titlepage"/> 40 41 <xsl:if test="$preamble"> 42 <xsl:apply-templates select="$preamble"/> 43 </xsl:if> 44 45 <xsl:if test="$divs"> 46 <xsl:apply-templates select="$divs"/> 47 </xsl:if> 48 49 <xsl:if test="$entries"> 50 <fo:list-block provisional-distance-between-starts="{$glossterm-width}" 51 provisional-label-separation="{$glossterm-sep}" 52 xsl:use-attribute-sets="normal.para.spacing"> 53 <xsl:apply-templates select="$entries"/> 54 </fo:list-block> 55 </xsl:if> 56 </fo:block> 57</xsl:template> 58 59<xsl:template match="book/glossary"> 60 <xsl:variable name="divs" select="glossdiv"/> 61 <xsl:variable name="entries" select="glossentry"/> 62 <xsl:variable name="preamble" 63 select="*[not(self::title 64 or self::subtitle 65 or self::glossdiv 66 or self::glossentry)]"/> 67 68 <xsl:variable name="id"> 69 <xsl:call-template name="object.id"/> 70 </xsl:variable> 71 72 <xsl:variable name="master-name"> 73 <xsl:call-template name="select.pagemaster"/> 74 </xsl:variable> 75 76 <fo:page-sequence id="{$id}" 77 hyphenate="{$hyphenate}" 78 master-name="{$master-name}"> 79 <xsl:attribute name="language"> 80 <xsl:call-template name="l10n.language"/> 81 </xsl:attribute> 82 <xsl:if test="$double.sided != 0"> 83 <xsl:attribute name="force-page-count">end-on-even</xsl:attribute> 84 </xsl:if> 85 86 <xsl:apply-templates select="." mode="running.head.mode"> 87 <xsl:with-param name="master-name" select="$master-name"/> 88 </xsl:apply-templates> 89 <xsl:apply-templates select="." mode="running.foot.mode"> 90 <xsl:with-param name="master-name" select="$master-name"/> 91 </xsl:apply-templates> 92 93 <fo:flow flow-name="xsl-region-body"> 94 <xsl:call-template name="glossary.titlepage"/> 95 96 <xsl:if test="$preamble"> 97 <xsl:apply-templates select="$preamble"/> 98 </xsl:if> 99 100 <xsl:if test="$divs"> 101 <xsl:apply-templates select="$divs"/> 102 </xsl:if> 103 104 <xsl:if test="$entries"> 105 <fo:list-block provisional-distance-between-starts="{$glossterm-width}" 106 provisional-label-separation="{$glossterm-sep}" 107 xsl:use-attribute-sets="normal.para.spacing"> 108 <xsl:apply-templates select="$entries"/> 109 </fo:list-block> 110 </xsl:if> 111 </fo:flow> 112 </fo:page-sequence> 113</xsl:template> 114 115<xsl:template match="glossary/glossaryinfo"></xsl:template> 116<xsl:template match="glossary/title"></xsl:template> 117<xsl:template match="glossary/subtitle"></xsl:template> 118<xsl:template match="glossary/titleabbrev"></xsl:template> 119 120<xsl:template match="glossary/title" mode="component.title.mode"> 121 <fo:block font-size="18pt" 122 font-weight="bold" 123 keep-with-next.within-column="always" 124 hyphenate="false"> 125 <xsl:apply-templates/> 126 </fo:block> 127</xsl:template> 128 129<xsl:template match="glossary/subtitle" mode="component.title.mode"> 130 <fo:block font-size="16pt" 131 font-weight="bold" 132 font-style="italic" 133 keep-with-next.within-column="always" 134 hyphenate="false"> 135 <xsl:apply-templates/> 136 </fo:block> 137</xsl:template> 138 139<!-- ==================================================================== --> 140 141<xsl:template match="glosslist"> 142 <fo:list-block provisional-distance-between-starts="{$glossterm-width}" 143 provisional-label-separation="{$glossterm-sep}" 144 xsl:use-attribute-sets="normal.para.spacing"> 145 <xsl:apply-templates/> 146 </fo:list-block> 147</xsl:template> 148 149<!-- ==================================================================== --> 150 151<xsl:template match="glossdiv"> 152 <xsl:variable name="entries" select="glossentry"/> 153 <xsl:variable name="preamble" 154 select="*[not(self::title 155 or self::subtitle 156 or self::glossentry)]"/> 157 158 <xsl:apply-templates select="title|subtitle"/> 159 <xsl:apply-templates select="$preamble"/> 160 <fo:list-block provisional-distance-between-starts="{$glossterm-width}" 161 provisional-label-separation="{$glossterm-sep}" 162 xsl:use-attribute-sets="normal.para.spacing"> 163 <xsl:apply-templates select="$entries"/> 164 </fo:list-block> 165</xsl:template> 166 167<xsl:template match="glossdiv/title"> 168 <fo:block font-size="16pt" font-weight="bold"> 169 <xsl:apply-templates/> 170 </fo:block> 171</xsl:template> 172 173<!-- ==================================================================== --> 174 175<!-- 176GlossEntry ::= 177 GlossTerm, Acronym?, Abbrev?, 178 (IndexTerm)*, 179 RevHistory?, 180 (GlossSee | GlossDef+) 181--> 182 183<xsl:template match="glossentry"> 184 <xsl:variable name="id"> 185 <xsl:call-template name="object.id"/> 186 </xsl:variable> 187 188 <fo:list-item id="{$id}" 189 xsl:use-attribute-sets="normal.para.spacing"> 190 <xsl:apply-templates/> 191 </fo:list-item> 192</xsl:template> 193 194<xsl:template match="glossentry/glossterm"> 195 <fo:list-item-label end-indent="label-end()"> 196 <fo:block> 197 <xsl:apply-templates/> 198 </fo:block> 199 </fo:list-item-label> 200</xsl:template> 201 202<xsl:template match="glossentry/acronym"> 203</xsl:template> 204 205<xsl:template match="glossentry/abbrev"> 206</xsl:template> 207 208<xsl:template match="glossentry/revhistory"> 209</xsl:template> 210 211<xsl:template match="glossentry/glosssee"> 212 <xsl:variable name="otherterm" select="@otherterm"/> 213 <xsl:variable name="targets" select="//node()[@id=$otherterm]"/> 214 <xsl:variable name="target" select="$targets[1]"/> 215 <fo:list-item-body start-indent="body-start()"> 216 <fo:block> 217 <xsl:call-template name="gentext.template"> 218 <xsl:with-param name="context" select="'glossary'"/> 219 <xsl:with-param name="name" select="'see'"/> 220 </xsl:call-template> 221 <xsl:choose> 222 <xsl:when test="@otherterm"> 223 <xsl:apply-templates select="$target" mode="xref"/> 224 </xsl:when> 225 <xsl:otherwise> 226 <xsl:apply-templates/> 227 </xsl:otherwise> 228 </xsl:choose> 229 <xsl:text>.</xsl:text> 230 </fo:block> 231 </fo:list-item-body> 232</xsl:template> 233 234<xsl:template match="glossentry/glossdef"> 235 <fo:list-item-body start-indent="body-start()"> 236 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/> 237 <xsl:if test="glossseealso"> 238 <fo:block> 239 <xsl:call-template name="gentext.template"> 240 <xsl:with-param name="context" select="'glossary'"/> 241 <xsl:with-param name="name" select="'seealso'"/> 242 </xsl:call-template> 243 <xsl:apply-templates select="glossseealso"/> 244 </fo:block> 245 </xsl:if> 246 </fo:list-item-body> 247</xsl:template> 248 249<xsl:template match="glossentry/glossdef/para[1]"> 250 <fo:block> 251 <xsl:apply-templates/> 252 </fo:block> 253</xsl:template> 254 255<xsl:template match="glossseealso"> 256 <xsl:variable name="otherterm" select="@otherterm"/> 257 <xsl:variable name="targets" select="//node()[@id=$otherterm]"/> 258 <xsl:variable name="target" select="$targets[1]"/> 259 260 <xsl:choose> 261 <xsl:when test="@otherterm"> 262 <xsl:apply-templates select="$target" mode="xref"/> 263 </xsl:when> 264 <xsl:otherwise> 265 <xsl:apply-templates/> 266 </xsl:otherwise> 267 </xsl:choose> 268 269 <xsl:choose> 270 <xsl:when test="position() = last()"> 271 <xsl:text>.</xsl:text> 272 </xsl:when> 273 <xsl:otherwise> 274 <xsl:text>, </xsl:text> 275 </xsl:otherwise> 276 </xsl:choose> 277</xsl:template> 278 279<!-- ==================================================================== --> 280 281<xsl:template match="glossentry" mode="xref"> 282 <xsl:apply-templates select="/glossterm[1]" mode="xref"/> 283</xsl:template> 284 285<xsl:template match="glossterm" mode="xref"> 286 <xsl:variable name="id"> 287 <xsl:call-template name="object.id"> 288 <xsl:with-param name="object" select="parent::glossentry"/> 289 </xsl:call-template> 290 </xsl:variable> 291 292 <fo:basic-link internal-destination="{$id}" 293 xsl:use-attribute-sets="xref.properties"> 294 <xsl:apply-templates/> 295 <xsl:call-template name="insert.page.citation"> 296 <xsl:with-param name="id" select="$id"/> 297 </xsl:call-template> 298 </fo:basic-link> 299</xsl:template> 300 301 302<!-- ==================================================================== --> 303 304</xsl:stylesheet> 305