glossary.xsl 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <?xml version='1.0'?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY % common.entities SYSTEM "../common/entities.ent">
  4. %common.entities;
  5. ]>
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  8. version='1.0'>
  9. <!-- ********************************************************************
  10. $Id$
  11. ********************************************************************
  12. This file is part of the XSL DocBook Stylesheet distribution.
  13. See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  14. and other information.
  15. ******************************************************************** -->
  16. <!-- ==================================================================== -->
  17. <xsl:template match="glossary">
  18. <xsl:call-template name="make-glossary"/>
  19. </xsl:template>
  20. <xsl:template match="glossdiv/title"/>
  21. <xsl:template match="glossdiv/subtitle"/>
  22. <xsl:template match="glossdiv/titleabbrev"/>
  23. <!-- ==================================================================== -->
  24. <xsl:template name="make-glossary">
  25. <xsl:param name="divs" select="glossdiv"/>
  26. <xsl:param name="entries" select="glossentry"/>
  27. <xsl:param name="preamble" select="*[not(self::title
  28. or self::subtitle
  29. or self::glossdiv
  30. or self::glossentry)]"/>
  31. &setup-language-variable;
  32. <xsl:variable name="id">
  33. <xsl:call-template name="object.id"/>
  34. </xsl:variable>
  35. <xsl:variable name="presentation">
  36. <xsl:call-template name="dbfo-attribute">
  37. <xsl:with-param name="pis"
  38. select="processing-instruction('dbfo')"/>
  39. <xsl:with-param name="attribute" select="'glossary-presentation'"/>
  40. </xsl:call-template>
  41. </xsl:variable>
  42. <xsl:variable name="term-width">
  43. <xsl:call-template name="dbfo-attribute">
  44. <xsl:with-param name="pis"
  45. select="processing-instruction('dbfo')"/>
  46. <xsl:with-param name="attribute" select="'glossterm-width'"/>
  47. </xsl:call-template>
  48. </xsl:variable>
  49. <xsl:variable name="width">
  50. <xsl:choose>
  51. <xsl:when test="$term-width = ''">
  52. <xsl:value-of select="$glossterm.width"/>
  53. </xsl:when>
  54. <xsl:otherwise>
  55. <xsl:value-of select="$term-width"/>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. </xsl:variable>
  59. <fo:block id="{$id}">
  60. <xsl:call-template name="glossary.titlepage"/>
  61. </fo:block>
  62. <xsl:if test="$preamble">
  63. <xsl:apply-templates select="$preamble"/>
  64. </xsl:if>
  65. <xsl:choose>
  66. <xsl:when test="$presentation = 'list'">
  67. <xsl:apply-templates select="$divs" mode="glossary.as.list">
  68. <xsl:with-param name="width" select="$width"/>
  69. </xsl:apply-templates>
  70. <xsl:if test="$entries">
  71. <fo:list-block provisional-distance-between-starts="{$width}"
  72. provisional-label-separation="{$glossterm.separation}"
  73. xsl:use-attribute-sets="normal.para.spacing">
  74. <xsl:choose>
  75. <xsl:when test="$glossary.sort != 0">
  76. <xsl:apply-templates select="$entries" mode="glossary.as.list">
  77. <xsl:sort lang="{$language}"
  78. select="translate(glossterm, $lowercase,
  79. $uppercase)"/>
  80. </xsl:apply-templates>
  81. </xsl:when>
  82. <xsl:otherwise>
  83. <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </fo:list-block>
  87. </xsl:if>
  88. </xsl:when>
  89. <xsl:when test="$presentation = 'blocks'">
  90. <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
  91. <xsl:choose>
  92. <xsl:when test="$glossary.sort != 0">
  93. <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
  94. <xsl:sort lang="{$language}"
  95. select="translate(glossterm, $lowercase,
  96. $uppercase)"/>
  97. </xsl:apply-templates>
  98. </xsl:when>
  99. <xsl:otherwise>
  100. <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
  101. </xsl:otherwise>
  102. </xsl:choose>
  103. </xsl:when>
  104. <xsl:when test="$glossary.as.blocks != 0">
  105. <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
  106. <xsl:choose>
  107. <xsl:when test="$glossary.sort != 0">
  108. <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
  109. <xsl:sort lang="{$language}"
  110. select="translate(glossterm, $lowercase,
  111. $uppercase)"/>
  112. </xsl:apply-templates>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
  116. </xsl:otherwise>
  117. </xsl:choose>
  118. </xsl:when>
  119. <xsl:otherwise>
  120. <xsl:apply-templates select="$divs" mode="glossary.as.list">
  121. <xsl:with-param name="width" select="$width"/>
  122. </xsl:apply-templates>
  123. <xsl:if test="$entries">
  124. <fo:list-block provisional-distance-between-starts="{$width}"
  125. provisional-label-separation="{$glossterm.separation}"
  126. xsl:use-attribute-sets="normal.para.spacing">
  127. <xsl:choose>
  128. <xsl:when test="$glossary.sort != 0">
  129. <xsl:apply-templates select="$entries" mode="glossary.as.list">
  130. <xsl:sort lang="{$language}"
  131. select="translate(glossterm, $lowercase,
  132. $uppercase)"/>
  133. </xsl:apply-templates>
  134. </xsl:when>
  135. <xsl:otherwise>
  136. <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
  137. </xsl:otherwise>
  138. </xsl:choose>
  139. </fo:list-block>
  140. </xsl:if>
  141. </xsl:otherwise>
  142. </xsl:choose>
  143. </xsl:template>
  144. <xsl:template match="book/glossary|part/glossary|/glossary" priority="2">
  145. <xsl:variable name="id">
  146. <xsl:call-template name="object.id"/>
  147. </xsl:variable>
  148. <xsl:variable name="master-reference">
  149. <xsl:call-template name="select.pagemaster"/>
  150. </xsl:variable>
  151. <fo:page-sequence hyphenate="{$hyphenate}"
  152. master-reference="{$master-reference}">
  153. <xsl:attribute name="language">
  154. <xsl:call-template name="l10n.language"/>
  155. </xsl:attribute>
  156. <xsl:attribute name="format">
  157. <xsl:call-template name="page.number.format">
  158. <xsl:with-param name="master-reference" select="$master-reference"/>
  159. </xsl:call-template>
  160. </xsl:attribute>
  161. <xsl:attribute name="initial-page-number">
  162. <xsl:call-template name="initial.page.number">
  163. <xsl:with-param name="master-reference" select="$master-reference"/>
  164. </xsl:call-template>
  165. </xsl:attribute>
  166. <xsl:attribute name="force-page-count">
  167. <xsl:call-template name="force.page.count">
  168. <xsl:with-param name="master-reference" select="$master-reference"/>
  169. </xsl:call-template>
  170. </xsl:attribute>
  171. <xsl:attribute name="hyphenation-character">
  172. <xsl:call-template name="gentext">
  173. <xsl:with-param name="key" select="'hyphenation-character'"/>
  174. </xsl:call-template>
  175. </xsl:attribute>
  176. <xsl:attribute name="hyphenation-push-character-count">
  177. <xsl:call-template name="gentext">
  178. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  179. </xsl:call-template>
  180. </xsl:attribute>
  181. <xsl:attribute name="hyphenation-remain-character-count">
  182. <xsl:call-template name="gentext">
  183. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  184. </xsl:call-template>
  185. </xsl:attribute>
  186. <xsl:apply-templates select="." mode="running.head.mode">
  187. <xsl:with-param name="master-reference" select="$master-reference"/>
  188. </xsl:apply-templates>
  189. <xsl:apply-templates select="." mode="running.foot.mode">
  190. <xsl:with-param name="master-reference" select="$master-reference"/>
  191. </xsl:apply-templates>
  192. <fo:flow flow-name="xsl-region-body">
  193. <xsl:call-template name="set.flow.properties">
  194. <xsl:with-param name="element" select="local-name(.)"/>
  195. <xsl:with-param name="master-reference" select="$master-reference"/>
  196. </xsl:call-template>
  197. <xsl:call-template name="make-glossary"/>
  198. </fo:flow>
  199. </fo:page-sequence>
  200. </xsl:template>
  201. <xsl:template match="glossary/glossaryinfo"></xsl:template>
  202. <xsl:template match="glossary/info"></xsl:template>
  203. <xsl:template match="glossary/title"></xsl:template>
  204. <xsl:template match="glossary/subtitle"></xsl:template>
  205. <xsl:template match="glossary/titleabbrev"></xsl:template>
  206. <!-- ==================================================================== -->
  207. <xsl:template match="glosslist">
  208. &setup-language-variable;
  209. <xsl:variable name="presentation">
  210. <xsl:call-template name="dbfo-attribute">
  211. <xsl:with-param name="pis"
  212. select="processing-instruction('dbfo')"/>
  213. <xsl:with-param name="attribute" select="'glosslist-presentation'"/>
  214. </xsl:call-template>
  215. </xsl:variable>
  216. <xsl:variable name="term-width">
  217. <xsl:call-template name="dbfo-attribute">
  218. <xsl:with-param name="pis"
  219. select="processing-instruction('dbfo')"/>
  220. <xsl:with-param name="attribute" select="'glossterm-width'"/>
  221. </xsl:call-template>
  222. </xsl:variable>
  223. <xsl:variable name="width">
  224. <xsl:choose>
  225. <xsl:when test="$term-width = ''">
  226. <xsl:value-of select="$glossterm.width"/>
  227. </xsl:when>
  228. <xsl:otherwise>
  229. <xsl:value-of select="$term-width"/>
  230. </xsl:otherwise>
  231. </xsl:choose>
  232. </xsl:variable>
  233. <xsl:if test="title or info/title">
  234. <xsl:apply-templates select="(title|info/title)[1]" mode="list.title.mode"/>
  235. </xsl:if>
  236. <xsl:choose>
  237. <xsl:when test="$presentation = 'list'">
  238. <fo:list-block provisional-distance-between-starts="{$width}"
  239. provisional-label-separation="{$glossterm.separation}"
  240. xsl:use-attribute-sets="normal.para.spacing">
  241. <xsl:choose>
  242. <xsl:when test="$glossary.sort != 0">
  243. <xsl:apply-templates select="glossentry" mode="glossary.as.list">
  244. <xsl:sort lang="{$language}"
  245. select="translate(glossterm, $lowercase,
  246. $uppercase)"/>
  247. </xsl:apply-templates>
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <xsl:apply-templates select="glossentry" mode="glossary.as.list"/>
  251. </xsl:otherwise>
  252. </xsl:choose>
  253. </fo:list-block>
  254. </xsl:when>
  255. <xsl:when test="$presentation = 'blocks'">
  256. <xsl:choose>
  257. <xsl:when test="$glossary.sort != 0">
  258. <xsl:apply-templates select="glossentry" mode="glossary.as.blocks">
  259. <xsl:sort lang="{$language}"
  260. select="translate(glossterm, $lowercase,
  261. $uppercase)"/>
  262. </xsl:apply-templates>
  263. </xsl:when>
  264. <xsl:otherwise>
  265. <xsl:apply-templates select="glossentry" mode="glossary.as.blocks"/>
  266. </xsl:otherwise>
  267. </xsl:choose>
  268. </xsl:when>
  269. <xsl:when test="$glosslist.as.blocks != 0">
  270. <xsl:choose>
  271. <xsl:when test="$glossary.sort != 0">
  272. <xsl:apply-templates select="glossentry" mode="glossary.as.blocks">
  273. <xsl:sort lang="{$language}"
  274. select="translate(glossterm, $lowercase,
  275. $uppercase)"/>
  276. </xsl:apply-templates>
  277. </xsl:when>
  278. <xsl:otherwise>
  279. <xsl:apply-templates select="glossentry" mode="glossary.as.blocks"/>
  280. </xsl:otherwise>
  281. </xsl:choose>
  282. </xsl:when>
  283. <xsl:otherwise>
  284. <fo:list-block provisional-distance-between-starts="{$width}"
  285. provisional-label-separation="{$glossterm.separation}"
  286. xsl:use-attribute-sets="normal.para.spacing">
  287. <xsl:choose>
  288. <xsl:when test="$glossary.sort != 0">
  289. <xsl:apply-templates select="glossentry" mode="glossary.as.list">
  290. <xsl:sort lang="{$language}"
  291. select="translate(glossterm, $lowercase,
  292. $uppercase)"/>
  293. </xsl:apply-templates>
  294. </xsl:when>
  295. <xsl:otherwise>
  296. <xsl:apply-templates select="glossentry" mode="glossary.as.list"/>
  297. </xsl:otherwise>
  298. </xsl:choose>
  299. </fo:list-block>
  300. </xsl:otherwise>
  301. </xsl:choose>
  302. </xsl:template>
  303. <!-- ==================================================================== -->
  304. <!-- Glossary collection -->
  305. <xsl:template match="glossary[@role='auto']" priority="2">
  306. <xsl:variable name="collection" select="document($glossary.collection, .)"/>
  307. <xsl:if test="$glossary.collection = ''">
  308. <xsl:message>
  309. <xsl:text>Warning: processing automatic glossary </xsl:text>
  310. <xsl:text>without a glossary.collection file.</xsl:text>
  311. </xsl:message>
  312. </xsl:if>
  313. <xsl:if test="not($collection) and $glossary.collection != ''">
  314. <xsl:message>
  315. <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
  316. <xsl:text>open glossary.collection file '</xsl:text>
  317. <xsl:value-of select="$glossary.collection"/>
  318. <xsl:text>'</xsl:text>
  319. </xsl:message>
  320. </xsl:if>
  321. <xsl:call-template name="make-auto-glossary"/>
  322. </xsl:template>
  323. <xsl:template name="make-auto-glossary">
  324. <xsl:param name="collection" select="document($glossary.collection, .)"/>
  325. <xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
  326. <xsl:param name="preamble" select="*[not(self::title
  327. or self::subtitle
  328. or self::glossdiv
  329. or self::glossentry)]"/>
  330. &setup-language-variable;
  331. <xsl:variable name="id">
  332. <xsl:call-template name="object.id"/>
  333. </xsl:variable>
  334. <xsl:variable name="presentation">
  335. <xsl:call-template name="dbfo-attribute">
  336. <xsl:with-param name="pis"
  337. select="processing-instruction('dbfo')"/>
  338. <xsl:with-param name="attribute" select="'glossary-presentation'"/>
  339. </xsl:call-template>
  340. </xsl:variable>
  341. <xsl:variable name="term-width">
  342. <xsl:call-template name="dbfo-attribute">
  343. <xsl:with-param name="pis"
  344. select="processing-instruction('dbfo')"/>
  345. <xsl:with-param name="attribute" select="'glossterm-width'"/>
  346. </xsl:call-template>
  347. </xsl:variable>
  348. <xsl:variable name="width">
  349. <xsl:choose>
  350. <xsl:when test="$term-width = ''">
  351. <xsl:value-of select="$glossterm.width"/>
  352. </xsl:when>
  353. <xsl:otherwise>
  354. <xsl:value-of select="$term-width"/>
  355. </xsl:otherwise>
  356. </xsl:choose>
  357. </xsl:variable>
  358. <xsl:if test="$glossary.collection = ''">
  359. <xsl:message>
  360. <xsl:text>Warning: processing automatic glossary </xsl:text>
  361. <xsl:text>without a glossary.collection file.</xsl:text>
  362. </xsl:message>
  363. </xsl:if>
  364. <fo:block id="{$id}">
  365. <xsl:call-template name="glossary.titlepage"/>
  366. </fo:block>
  367. <xsl:if test="$preamble">
  368. <xsl:apply-templates select="$preamble"/>
  369. </xsl:if>
  370. <xsl:choose>
  371. <xsl:when test="glossdiv and $collection//glossdiv">
  372. <xsl:for-each select="$collection//glossdiv">
  373. <!-- first see if there are any in this div -->
  374. <xsl:variable name="exist.test">
  375. <xsl:for-each select="glossentry">
  376. <xsl:variable name="cterm" select="glossterm"/>
  377. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  378. <xsl:value-of select="glossterm"/>
  379. </xsl:if>
  380. </xsl:for-each>
  381. </xsl:variable>
  382. <xsl:if test="$exist.test != ''">
  383. <xsl:choose>
  384. <xsl:when test="$presentation = 'list'">
  385. <xsl:apply-templates select="." mode="auto-glossary-as-list">
  386. <xsl:with-param name="width" select="$width"/>
  387. <xsl:with-param name="terms" select="$terms"/>
  388. </xsl:apply-templates>
  389. </xsl:when>
  390. <xsl:when test="$presentation = 'blocks'">
  391. <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
  392. <xsl:with-param name="terms" select="$terms"/>
  393. </xsl:apply-templates>
  394. </xsl:when>
  395. <xsl:when test="$glossary.as.blocks != 0">
  396. <xsl:apply-templates select="." mode="auto-glossary-as-blocks">
  397. <xsl:with-param name="terms" select="$terms"/>
  398. </xsl:apply-templates>
  399. </xsl:when>
  400. <xsl:otherwise>
  401. <xsl:apply-templates select="." mode="auto-glossary-as-list">
  402. <xsl:with-param name="width" select="$width"/>
  403. <xsl:with-param name="terms" select="$terms"/>
  404. </xsl:apply-templates>
  405. </xsl:otherwise>
  406. </xsl:choose>
  407. </xsl:if>
  408. </xsl:for-each>
  409. </xsl:when>
  410. <xsl:otherwise>
  411. <xsl:choose>
  412. <xsl:when test="$presentation = 'list'">
  413. <fo:list-block provisional-distance-between-starts="{$width}"
  414. provisional-label-separation="{$glossterm.separation}"
  415. xsl:use-attribute-sets="normal.para.spacing">
  416. <xsl:choose>
  417. <xsl:when test="$glossary.sort != 0">
  418. <xsl:for-each select="$collection//glossentry">
  419. <xsl:sort lang="{$language}"
  420. select="translate(glossterm, $lowercase,
  421. $uppercase)"/>
  422. <xsl:variable name="cterm" select="glossterm"/>
  423. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  424. <xsl:apply-templates select="."
  425. mode="auto-glossary-as-list"/>
  426. </xsl:if>
  427. </xsl:for-each>
  428. </xsl:when>
  429. <xsl:otherwise>
  430. <xsl:for-each select="$collection//glossentry">
  431. <xsl:variable name="cterm" select="glossterm"/>
  432. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  433. <xsl:apply-templates select="."
  434. mode="auto-glossary-as-list"/>
  435. </xsl:if>
  436. </xsl:for-each>
  437. </xsl:otherwise>
  438. </xsl:choose>
  439. </fo:list-block>
  440. </xsl:when>
  441. <xsl:when test="$presentation = 'blocks' or
  442. $glossary.as.blocks != 0">
  443. <xsl:choose>
  444. <xsl:when test="$glossary.sort != 0">
  445. <xsl:for-each select="$collection//glossentry">
  446. <xsl:sort lang="{$language}"
  447. select="translate(glossterm, $lowercase,
  448. $uppercase)"/>
  449. <xsl:variable name="cterm" select="glossterm"/>
  450. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  451. <xsl:apply-templates select="."
  452. mode="auto-glossary-as-blocks"/>
  453. </xsl:if>
  454. </xsl:for-each>
  455. </xsl:when>
  456. <xsl:otherwise>
  457. <xsl:for-each select="$collection//glossentry">
  458. <xsl:variable name="cterm" select="glossterm"/>
  459. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  460. <xsl:apply-templates select="."
  461. mode="auto-glossary-as-blocks"/>
  462. </xsl:if>
  463. </xsl:for-each>
  464. </xsl:otherwise>
  465. </xsl:choose>
  466. </xsl:when>
  467. <xsl:otherwise>
  468. <fo:list-block provisional-distance-between-starts="{$width}"
  469. provisional-label-separation="{$glossterm.separation}"
  470. xsl:use-attribute-sets="normal.para.spacing">
  471. <xsl:choose>
  472. <xsl:when test="$glossary.sort != 0">
  473. <xsl:for-each select="$collection//glossentry">
  474. <xsl:sort lang="{$language}"
  475. select="translate(glossterm, $lowercase,
  476. $uppercase)"/>
  477. <xsl:variable name="cterm" select="glossterm"/>
  478. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  479. <xsl:apply-templates select="."
  480. mode="auto-glossary-as-list"/>
  481. </xsl:if>
  482. </xsl:for-each>
  483. </xsl:when>
  484. <xsl:otherwise>
  485. <xsl:for-each select="$collection//glossentry">
  486. <xsl:variable name="cterm" select="glossterm"/>
  487. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  488. <xsl:apply-templates select="."
  489. mode="auto-glossary-as-list"/>
  490. </xsl:if>
  491. </xsl:for-each>
  492. </xsl:otherwise>
  493. </xsl:choose>
  494. </fo:list-block>
  495. </xsl:otherwise>
  496. </xsl:choose>
  497. </xsl:otherwise>
  498. </xsl:choose>
  499. </xsl:template>
  500. <xsl:template match="book/glossary[@role='auto']|
  501. part/glossary[@role='auto']|
  502. /glossary[@role='auto']" priority="2.5">
  503. <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
  504. <xsl:variable name="master-reference">
  505. <xsl:call-template name="select.pagemaster"/>
  506. </xsl:variable>
  507. <xsl:if test="$glossary.collection = ''">
  508. <xsl:message>
  509. <xsl:text>Warning: processing automatic glossary </xsl:text>
  510. <xsl:text>without a glossary.collection file.</xsl:text>
  511. </xsl:message>
  512. </xsl:if>
  513. <fo:page-sequence hyphenate="{$hyphenate}"
  514. master-reference="{$master-reference}">
  515. <xsl:attribute name="language">
  516. <xsl:call-template name="l10n.language"/>
  517. </xsl:attribute>
  518. <xsl:attribute name="format">
  519. <xsl:call-template name="page.number.format">
  520. <xsl:with-param name="master-reference" select="$master-reference"/>
  521. </xsl:call-template>
  522. </xsl:attribute>
  523. <xsl:attribute name="initial-page-number">
  524. <xsl:call-template name="initial.page.number">
  525. <xsl:with-param name="master-reference" select="$master-reference"/>
  526. </xsl:call-template>
  527. </xsl:attribute>
  528. <xsl:attribute name="force-page-count">
  529. <xsl:call-template name="force.page.count">
  530. <xsl:with-param name="master-reference" select="$master-reference"/>
  531. </xsl:call-template>
  532. </xsl:attribute>
  533. <xsl:attribute name="hyphenation-character">
  534. <xsl:call-template name="gentext">
  535. <xsl:with-param name="key" select="'hyphenation-character'"/>
  536. </xsl:call-template>
  537. </xsl:attribute>
  538. <xsl:attribute name="hyphenation-push-character-count">
  539. <xsl:call-template name="gentext">
  540. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  541. </xsl:call-template>
  542. </xsl:attribute>
  543. <xsl:attribute name="hyphenation-remain-character-count">
  544. <xsl:call-template name="gentext">
  545. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  546. </xsl:call-template>
  547. </xsl:attribute>
  548. <xsl:apply-templates select="." mode="running.head.mode">
  549. <xsl:with-param name="master-reference" select="$master-reference"/>
  550. </xsl:apply-templates>
  551. <xsl:apply-templates select="." mode="running.foot.mode">
  552. <xsl:with-param name="master-reference" select="$master-reference"/>
  553. </xsl:apply-templates>
  554. <fo:flow flow-name="xsl-region-body">
  555. <xsl:call-template name="set.flow.properties">
  556. <xsl:with-param name="element" select="local-name(.)"/>
  557. <xsl:with-param name="master-reference" select="$master-reference"/>
  558. </xsl:call-template>
  559. <xsl:call-template name="make-auto-glossary"/>
  560. </fo:flow>
  561. </fo:page-sequence>
  562. </xsl:template>
  563. <xsl:template match="glossdiv" mode="auto-glossary-as-list">
  564. <xsl:param name="width" select="$glossterm.width"/>
  565. <xsl:param name="terms" select="."/>
  566. &setup-language-variable;
  567. <xsl:variable name="preamble"
  568. select="*[not(self::title
  569. or self::subtitle
  570. or self::glossentry)]"/>
  571. <xsl:call-template name="glossdiv.titlepage"/>
  572. <xsl:apply-templates select="$preamble"/>
  573. <fo:list-block provisional-distance-between-starts="{$width}"
  574. provisional-label-separation="{$glossterm.separation}"
  575. xsl:use-attribute-sets="normal.para.spacing">
  576. <xsl:choose>
  577. <xsl:when test="$glossary.sort != 0">
  578. <xsl:for-each select="glossentry">
  579. <xsl:sort lang="{$language}"
  580. select="translate(glossterm, $lowercase, $uppercase)"/>
  581. <xsl:variable name="cterm" select="glossterm"/>
  582. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  583. <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
  584. </xsl:if>
  585. </xsl:for-each>
  586. </xsl:when>
  587. <xsl:otherwise>
  588. <xsl:for-each select="glossentry">
  589. <xsl:variable name="cterm" select="glossterm"/>
  590. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  591. <xsl:apply-templates select="." mode="auto-glossary-as-list"/>
  592. </xsl:if>
  593. </xsl:for-each>
  594. </xsl:otherwise>
  595. </xsl:choose>
  596. </fo:list-block>
  597. </xsl:template>
  598. <xsl:template match="glossentry" mode="auto-glossary-as-list">
  599. <xsl:apply-templates select="." mode="glossary.as.list"/>
  600. </xsl:template>
  601. <xsl:template match="glossdiv" mode="auto-glossary-as-blocks">
  602. <xsl:param name="terms" select="."/>
  603. &setup-language-variable;
  604. <xsl:variable name="preamble"
  605. select="*[not(self::title
  606. or self::subtitle
  607. or self::glossentry)]"/>
  608. <xsl:call-template name="glossdiv.titlepage"/>
  609. <xsl:apply-templates select="$preamble"/>
  610. <xsl:choose>
  611. <xsl:when test="$glossary.sort != 0">
  612. <xsl:for-each select="glossentry">
  613. <xsl:sort lang="{$language}"
  614. select="translate(glossterm, $lowercase, $uppercase)"/>
  615. <xsl:variable name="cterm" select="glossterm"/>
  616. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  617. <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
  618. </xsl:if>
  619. </xsl:for-each>
  620. </xsl:when>
  621. <xsl:otherwise>
  622. <xsl:for-each select="glossentry">
  623. <xsl:variable name="cterm" select="glossterm"/>
  624. <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
  625. <xsl:apply-templates select="." mode="auto-glossary-as-blocks"/>
  626. </xsl:if>
  627. </xsl:for-each>
  628. </xsl:otherwise>
  629. </xsl:choose>
  630. </xsl:template>
  631. <xsl:template match="glossentry" mode="auto-glossary-as-blocks">
  632. <xsl:apply-templates select="." mode="glossary.as.blocks"/>
  633. </xsl:template>
  634. <!-- ==================================================================== -->
  635. <!-- Format glossary as a list -->
  636. <xsl:template match="glossdiv" mode="glossary.as.list">
  637. <xsl:param name="width" select="$glossterm.width"/>
  638. &setup-language-variable;
  639. <xsl:variable name="entries" select="glossentry"/>
  640. <xsl:variable name="preamble"
  641. select="*[not(self::title
  642. or self::subtitle
  643. or self::glossentry)]"/>
  644. <xsl:call-template name="glossdiv.titlepage"/>
  645. <xsl:apply-templates select="$preamble"/>
  646. <fo:list-block provisional-distance-between-starts="{$width}"
  647. provisional-label-separation="{$glossterm.separation}"
  648. xsl:use-attribute-sets="normal.para.spacing">
  649. <xsl:choose>
  650. <xsl:when test="$glossary.sort != 0">
  651. <xsl:apply-templates select="$entries" mode="glossary.as.list">
  652. <xsl:sort lang="{$language}"
  653. select="translate(glossterm, $lowercase,
  654. $uppercase)"/>
  655. </xsl:apply-templates>
  656. </xsl:when>
  657. <xsl:otherwise>
  658. <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
  659. </xsl:otherwise>
  660. </xsl:choose>
  661. </fo:list-block>
  662. </xsl:template>
  663. <!--
  664. GlossEntry ::=
  665. GlossTerm, Acronym?, Abbrev?,
  666. (IndexTerm)*,
  667. RevHistory?,
  668. (GlossSee | GlossDef+)
  669. -->
  670. <xsl:template match="glossentry" mode="glossary.as.list">
  671. <xsl:variable name="id">
  672. <xsl:call-template name="object.id"/>
  673. </xsl:variable>
  674. <fo:list-item xsl:use-attribute-sets="normal.para.spacing">
  675. <xsl:call-template name="anchor">
  676. <xsl:with-param name="conditional">
  677. <xsl:choose>
  678. <xsl:when test="$glossterm.auto.link != 0
  679. or $glossary.collection != ''">0</xsl:when>
  680. <xsl:otherwise>1</xsl:otherwise>
  681. </xsl:choose>
  682. </xsl:with-param>
  683. </xsl:call-template>
  684. <fo:list-item-label end-indent="label-end()">
  685. <fo:block>
  686. <xsl:choose>
  687. <xsl:when test="$glossentry.show.acronym = 'primary'">
  688. <xsl:choose>
  689. <xsl:when test="acronym|abbrev">
  690. <xsl:apply-templates select="acronym|abbrev"
  691. mode="glossary.as.list"/>
  692. <xsl:text> (</xsl:text>
  693. <xsl:apply-templates select="glossterm"
  694. mode="glossary.as.list"/>
  695. <xsl:text>)</xsl:text>
  696. </xsl:when>
  697. <xsl:otherwise>
  698. <xsl:apply-templates select="glossterm"
  699. mode="glossary.as.list"/>
  700. </xsl:otherwise>
  701. </xsl:choose>
  702. </xsl:when>
  703. <xsl:when test="$glossentry.show.acronym = 'yes'">
  704. <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
  705. <xsl:if test="acronym|abbrev">
  706. <xsl:text> (</xsl:text>
  707. <xsl:apply-templates select="acronym|abbrev"
  708. mode="glossary.as.list"/>
  709. <xsl:text>)</xsl:text>
  710. </xsl:if>
  711. </xsl:when>
  712. <xsl:otherwise>
  713. <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
  714. </xsl:otherwise>
  715. </xsl:choose>
  716. <xsl:apply-templates select="indexterm"/>
  717. </fo:block>
  718. </fo:list-item-label>
  719. <fo:list-item-body start-indent="body-start()">
  720. <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.list"/>
  721. </fo:list-item-body>
  722. </fo:list-item>
  723. </xsl:template>
  724. <xsl:template match="glossentry/glossterm" mode="glossary.as.list">
  725. <xsl:variable name="id">
  726. <xsl:call-template name="object.id"/>
  727. </xsl:variable>
  728. <fo:inline id="{$id}">
  729. <xsl:apply-templates/>
  730. </fo:inline>
  731. <xsl:if test="following-sibling::glossterm">, </xsl:if>
  732. </xsl:template>
  733. <xsl:template match="glossentry/acronym" mode="glossary.as.list">
  734. <xsl:apply-templates/>
  735. <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
  736. </xsl:template>
  737. <xsl:template match="glossentry/abbrev" mode="glossary.as.list">
  738. <xsl:apply-templates/>
  739. <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
  740. </xsl:template>
  741. <xsl:template match="glossentry/revhistory" mode="glossary.as.list">
  742. </xsl:template>
  743. <xsl:template match="glossentry/glosssee" mode="glossary.as.list">
  744. <xsl:variable name="otherterm" select="@otherterm"/>
  745. <xsl:variable name="targets" select="key('id', $otherterm)"/>
  746. <xsl:variable name="target" select="$targets[1]"/>
  747. <fo:block>
  748. <xsl:variable name="template">
  749. <xsl:call-template name="gentext.template">
  750. <xsl:with-param name="context" select="'glossary'"/>
  751. <xsl:with-param name="name" select="'see'"/>
  752. </xsl:call-template>
  753. </xsl:variable>
  754. <xsl:variable name="title">
  755. <xsl:choose>
  756. <xsl:when test="$target">
  757. <fo:basic-link internal-destination="{$otherterm}"
  758. xsl:use-attribute-sets="xref.properties">
  759. <xsl:apply-templates select="$target" mode="xref-to"/>
  760. </fo:basic-link>
  761. </xsl:when>
  762. <xsl:when test="$otherterm != '' and not($target)">
  763. <xsl:message>
  764. <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
  765. <xsl:value-of select="$otherterm"/>
  766. </xsl:message>
  767. <xsl:apply-templates mode="glossary.as.list"/>
  768. </xsl:when>
  769. <xsl:otherwise>
  770. <xsl:apply-templates mode="glossary.as.list"/>
  771. </xsl:otherwise>
  772. </xsl:choose>
  773. </xsl:variable>
  774. <xsl:call-template name="substitute-markup">
  775. <xsl:with-param name="template" select="$template"/>
  776. <xsl:with-param name="title" select="$title"/>
  777. </xsl:call-template>
  778. <xsl:text>.</xsl:text>
  779. </fo:block>
  780. </xsl:template>
  781. <xsl:template match="glossentry/glossdef" mode="glossary.as.list">
  782. <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
  783. <xsl:if test="glossseealso">
  784. <fo:block>
  785. <xsl:variable name="template">
  786. <xsl:call-template name="gentext.template">
  787. <xsl:with-param name="context" select="'glossary'"/>
  788. <xsl:with-param name="name" select="'seealso'"/>
  789. </xsl:call-template>
  790. </xsl:variable>
  791. <xsl:variable name="title">
  792. <xsl:apply-templates select="glossseealso" mode="glossary.as.list"/>
  793. </xsl:variable>
  794. <xsl:call-template name="substitute-markup">
  795. <xsl:with-param name="template" select="$template"/>
  796. <xsl:with-param name="title" select="$title"/>
  797. </xsl:call-template>
  798. </fo:block>
  799. </xsl:if>
  800. </xsl:template>
  801. <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
  802. mode="glossary.as.list">
  803. <fo:block>
  804. <xsl:apply-templates/>
  805. </fo:block>
  806. </xsl:template>
  807. <xsl:template match="glossseealso" mode="glossary.as.list">
  808. <xsl:variable name="otherterm" select="@otherterm"/>
  809. <xsl:variable name="targets" select="key('id', $otherterm)"/>
  810. <xsl:variable name="target" select="$targets[1]"/>
  811. <xsl:choose>
  812. <xsl:when test="$target">
  813. <fo:basic-link internal-destination="{$otherterm}"
  814. xsl:use-attribute-sets="xref.properties">
  815. <xsl:apply-templates select="$target" mode="xref-to"/>
  816. </fo:basic-link>
  817. </xsl:when>
  818. <xsl:when test="$otherterm != '' and not($target)">
  819. <xsl:message>
  820. <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
  821. <xsl:value-of select="$otherterm"/>
  822. </xsl:message>
  823. <xsl:apply-templates mode="glossary.as.list"/>
  824. </xsl:when>
  825. <xsl:otherwise>
  826. <xsl:apply-templates mode="glossary.as.list"/>
  827. </xsl:otherwise>
  828. </xsl:choose>
  829. <xsl:choose>
  830. <xsl:when test="position() = last()">
  831. <xsl:text>.</xsl:text>
  832. </xsl:when>
  833. <xsl:otherwise>
  834. <xsl:text>, </xsl:text>
  835. </xsl:otherwise>
  836. </xsl:choose>
  837. </xsl:template>
  838. <!-- ==================================================================== -->
  839. <!-- Format glossary blocks -->
  840. <xsl:template match="glossdiv" mode="glossary.as.blocks">
  841. &setup-language-variable;
  842. <xsl:variable name="entries" select="glossentry"/>
  843. <xsl:variable name="preamble"
  844. select="*[not(self::title
  845. or self::subtitle
  846. or self::glossentry)]"/>
  847. <xsl:call-template name="glossdiv.titlepage"/>
  848. <xsl:apply-templates select="$preamble"/>
  849. <xsl:choose>
  850. <xsl:when test="$glossary.sort != 0">
  851. <xsl:apply-templates select="$entries" mode="glossary.as.blocks">
  852. <xsl:sort lang="{$language}"
  853. select="translate(glossterm, $lowercase,
  854. $uppercase)"/>
  855. </xsl:apply-templates>
  856. </xsl:when>
  857. <xsl:otherwise>
  858. <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
  859. </xsl:otherwise>
  860. </xsl:choose>
  861. </xsl:template>
  862. <!--
  863. GlossEntry ::=
  864. GlossTerm, Acronym?, Abbrev?,
  865. (IndexTerm)*,
  866. RevHistory?,
  867. (GlossSee | GlossDef+)
  868. -->
  869. <xsl:template match="glossentry" mode="glossary.as.blocks">
  870. <xsl:variable name="id">
  871. <xsl:call-template name="object.id"/>
  872. </xsl:variable>
  873. <fo:block xsl:use-attribute-sets="list.item.spacing"
  874. keep-with-next.within-column="always"
  875. keep-together.within-column="always">
  876. <xsl:call-template name="anchor">
  877. <xsl:with-param name="conditional">
  878. <xsl:choose>
  879. <xsl:when test="$glossterm.auto.link != 0
  880. or $glossary.collection != ''">0</xsl:when>
  881. <xsl:otherwise>1</xsl:otherwise>
  882. </xsl:choose>
  883. </xsl:with-param>
  884. </xsl:call-template>
  885. <xsl:choose>
  886. <xsl:when test="$glossentry.show.acronym = 'primary'">
  887. <xsl:choose>
  888. <xsl:when test="acronym|abbrev">
  889. <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
  890. <xsl:text> (</xsl:text>
  891. <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
  892. <xsl:text>)</xsl:text>
  893. </xsl:when>
  894. <xsl:otherwise>
  895. <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
  896. </xsl:otherwise>
  897. </xsl:choose>
  898. </xsl:when>
  899. <xsl:when test="$glossentry.show.acronym = 'yes'">
  900. <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
  901. <xsl:if test="acronym|abbrev">
  902. <xsl:text> (</xsl:text>
  903. <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
  904. <xsl:text>)</xsl:text>
  905. </xsl:if>
  906. </xsl:when>
  907. <xsl:otherwise>
  908. <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
  909. </xsl:otherwise>
  910. </xsl:choose>
  911. <xsl:apply-templates select="indexterm"/>
  912. </fo:block>
  913. <fo:block margin-left="0.25in">
  914. <xsl:apply-templates select="glosssee|glossdef" mode="glossary.as.blocks"/>
  915. </fo:block>
  916. </xsl:template>
  917. <xsl:template match="glossentry/glossterm" mode="glossary.as.blocks">
  918. <xsl:variable name="id">
  919. <xsl:call-template name="object.id"/>
  920. </xsl:variable>
  921. <fo:inline id="{$id}">
  922. <xsl:apply-templates/>
  923. </fo:inline>
  924. <xsl:if test="following-sibling::glossterm">, </xsl:if>
  925. </xsl:template>
  926. <xsl:template match="glossentry/acronym" mode="glossary.as.blocks">
  927. <xsl:apply-templates/>
  928. <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
  929. </xsl:template>
  930. <xsl:template match="glossentry/abbrev" mode="glossary.as.blocks">
  931. <xsl:apply-templates/>
  932. <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
  933. </xsl:template>
  934. <xsl:template match="glossentry/glosssee" mode="glossary.as.blocks">
  935. <xsl:variable name="otherterm" select="@otherterm"/>
  936. <xsl:variable name="targets" select="key('id', $otherterm)"/>
  937. <xsl:variable name="target" select="$targets[1]"/>
  938. <xsl:variable name="template">
  939. <xsl:call-template name="gentext.template">
  940. <xsl:with-param name="context" select="'glossary'"/>
  941. <xsl:with-param name="name" select="'see'"/>
  942. </xsl:call-template>
  943. </xsl:variable>
  944. <xsl:variable name="title">
  945. <xsl:choose>
  946. <xsl:when test="$target">
  947. <fo:basic-link internal-destination="{$otherterm}"
  948. xsl:use-attribute-sets="xref.properties">
  949. <xsl:apply-templates select="$target" mode="xref-to"/>
  950. </fo:basic-link>
  951. </xsl:when>
  952. <xsl:when test="$otherterm != '' and not($target)">
  953. <xsl:message>
  954. <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
  955. <xsl:value-of select="$otherterm"/>
  956. </xsl:message>
  957. <xsl:apply-templates mode="glossary.as.blocks"/>
  958. </xsl:when>
  959. <xsl:otherwise>
  960. <xsl:apply-templates mode="glossary.as.blocks"/>
  961. </xsl:otherwise>
  962. </xsl:choose>
  963. </xsl:variable>
  964. <xsl:call-template name="substitute-markup">
  965. <xsl:with-param name="template" select="$template"/>
  966. <xsl:with-param name="title" select="$title"/>
  967. </xsl:call-template>
  968. <xsl:text>.</xsl:text>
  969. </xsl:template>
  970. <xsl:template match="glossentry/glossdef" mode="glossary.as.blocks">
  971. <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"
  972. mode="glossary.as.blocks"/>
  973. <xsl:if test="glossseealso">
  974. <fo:block>
  975. <xsl:variable name="template">
  976. <xsl:call-template name="gentext.template">
  977. <xsl:with-param name="context" select="'glossary'"/>
  978. <xsl:with-param name="name" select="'seealso'"/>
  979. </xsl:call-template>
  980. </xsl:variable>
  981. <xsl:variable name="title">
  982. <xsl:apply-templates select="glossseealso" mode="glossary.as.blocks"/>
  983. </xsl:variable>
  984. <xsl:call-template name="substitute-markup">
  985. <xsl:with-param name="template" select="$template"/>
  986. <xsl:with-param name="title" select="$title"/>
  987. </xsl:call-template>
  988. </fo:block>
  989. </xsl:if>
  990. </xsl:template>
  991. <xsl:template match="glossentry/glossdef/para[1]|glossentry/glossdef/simpara[1]"
  992. mode="glossary.as.blocks">
  993. <fo:block>
  994. <xsl:apply-templates/>
  995. </fo:block>
  996. </xsl:template>
  997. <!-- Handle any other glossdef content normally -->
  998. <xsl:template match="*" mode="glossary.as.blocks">
  999. <xsl:apply-templates select="." />
  1000. </xsl:template>
  1001. <xsl:template match="glossseealso" mode="glossary.as.blocks">
  1002. <xsl:variable name="otherterm" select="@otherterm"/>
  1003. <xsl:variable name="targets" select="key('id', $otherterm)"/>
  1004. <xsl:variable name="target" select="$targets[1]"/>
  1005. <xsl:choose>
  1006. <xsl:when test="$target">
  1007. <fo:basic-link internal-destination="{$otherterm}"
  1008. xsl:use-attribute-sets="xref.properties">
  1009. <xsl:apply-templates select="$target" mode="xref-to"/>
  1010. </fo:basic-link>
  1011. </xsl:when>
  1012. <xsl:when test="$otherterm != '' and not($target)">
  1013. <xsl:message>
  1014. <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
  1015. <xsl:value-of select="$otherterm"/>
  1016. </xsl:message>
  1017. <xsl:apply-templates mode="glossary.as.blocks"/>
  1018. </xsl:when>
  1019. <xsl:otherwise>
  1020. <xsl:apply-templates mode="glossary.as.blocks"/>
  1021. </xsl:otherwise>
  1022. </xsl:choose>
  1023. <xsl:choose>
  1024. <xsl:when test="position() = last()">
  1025. <xsl:text>.</xsl:text>
  1026. </xsl:when>
  1027. <xsl:otherwise>
  1028. <xsl:text>, </xsl:text>
  1029. </xsl:otherwise>
  1030. </xsl:choose>
  1031. </xsl:template>
  1032. <!-- ==================================================================== -->
  1033. </xsl:stylesheet>