titles.xsl 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  4. exclude-result-prefixes="doc"
  5. version='1.0'>
  6. <!-- ********************************************************************
  7. $Id$
  8. ********************************************************************
  9. This file is part of the XSL DocBook Stylesheet distribution.
  10. See ../README or http://docbook.sf.net/release/xsl/current/ for
  11. copyright and other information.
  12. ******************************************************************** -->
  13. <!-- ==================================================================== -->
  14. <!-- title markup -->
  15. <doc:mode mode="title.markup" xmlns="">
  16. <refpurpose>Provides access to element titles</refpurpose>
  17. <refdescription id="title.markup-desc">
  18. <para>Processing an element in the
  19. <literal role="mode">title.markup</literal> mode produces the
  20. title of the element. This does not include the label.
  21. </para>
  22. </refdescription>
  23. </doc:mode>
  24. <xsl:template match="*" mode="title.markup">
  25. <xsl:param name="allow-anchors" select="0"/>
  26. <xsl:param name="verbose" select="1"/>
  27. <xsl:choose>
  28. <!-- * FIXME: this should handle other *info elements as well -->
  29. <!-- * but this is good enough for now. -->
  30. <xsl:when test="title|info/title">
  31. <xsl:apply-templates select="title[1]|info/title[1]" mode="title.markup">
  32. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  33. </xsl:apply-templates>
  34. </xsl:when>
  35. <xsl:when test="local-name(.) = 'partintro'">
  36. <!-- partintro's don't have titles, use the parent (part or reference)
  37. title instead. -->
  38. <xsl:apply-templates select="parent::*" mode="title.markup"/>
  39. </xsl:when>
  40. <xsl:otherwise>
  41. <xsl:if test="$verbose != 0">
  42. <xsl:message>
  43. <xsl:text>Request for title of element with no title: </xsl:text>
  44. <xsl:value-of select="local-name(.)"/>
  45. <xsl:choose>
  46. <xsl:when test="@id">
  47. <xsl:text> (id="</xsl:text>
  48. <xsl:value-of select="@id"/>
  49. <xsl:text>")</xsl:text>
  50. </xsl:when>
  51. <xsl:when test="@xml:id">
  52. <xsl:text> (xml:id="</xsl:text>
  53. <xsl:value-of select="@xml:id"/>
  54. <xsl:text>")</xsl:text>
  55. </xsl:when>
  56. </xsl:choose>
  57. </xsl:message>
  58. </xsl:if>
  59. <xsl:text>???TITLE???</xsl:text>
  60. </xsl:otherwise>
  61. </xsl:choose>
  62. </xsl:template>
  63. <xsl:template match="title" mode="title.markup">
  64. <xsl:param name="allow-anchors" select="0"/>
  65. <xsl:choose>
  66. <xsl:when test="$allow-anchors != 0">
  67. <xsl:apply-templates/>
  68. </xsl:when>
  69. <xsl:otherwise>
  70. <xsl:apply-templates mode="no.anchor.mode"/>
  71. </xsl:otherwise>
  72. </xsl:choose>
  73. </xsl:template>
  74. <!-- only occurs in HTML Tables! -->
  75. <xsl:template match="caption" mode="title.markup">
  76. <xsl:param name="allow-anchors" select="0"/>
  77. <xsl:choose>
  78. <xsl:when test="$allow-anchors != 0">
  79. <xsl:apply-templates/>
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <xsl:apply-templates mode="no.anchor.mode"/>
  83. </xsl:otherwise>
  84. </xsl:choose>
  85. </xsl:template>
  86. <xsl:template match="set" mode="title.markup">
  87. <xsl:param name="allow-anchors" select="0"/>
  88. <xsl:apply-templates select="(setinfo/title|info/title|title)[1]"
  89. mode="title.markup">
  90. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  91. </xsl:apply-templates>
  92. </xsl:template>
  93. <xsl:template match="book" mode="title.markup">
  94. <xsl:param name="allow-anchors" select="0"/>
  95. <xsl:apply-templates select="(bookinfo/title|info/title|title)[1]"
  96. mode="title.markup">
  97. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  98. </xsl:apply-templates>
  99. </xsl:template>
  100. <xsl:template match="part" mode="title.markup">
  101. <xsl:param name="allow-anchors" select="0"/>
  102. <xsl:apply-templates select="(partinfo/title|info/title|docinfo/title|title)[1]"
  103. mode="title.markup">
  104. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  105. </xsl:apply-templates>
  106. </xsl:template>
  107. <xsl:template match="preface|chapter|appendix" mode="title.markup">
  108. <xsl:param name="allow-anchors" select="0"/>
  109. <!--
  110. <xsl:message>
  111. <xsl:value-of select="local-name(.)"/>
  112. <xsl:text> </xsl:text>
  113. <xsl:value-of select="$allow-anchors"/>
  114. </xsl:message>
  115. -->
  116. <xsl:variable name="title" select="(docinfo/title
  117. |info/title
  118. |prefaceinfo/title
  119. |chapterinfo/title
  120. |appendixinfo/title
  121. |title)[1]"/>
  122. <xsl:apply-templates select="$title" mode="title.markup">
  123. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  124. </xsl:apply-templates>
  125. </xsl:template>
  126. <xsl:template match="dedication" mode="title.markup">
  127. <xsl:param name="allow-anchors" select="0"/>
  128. <xsl:choose>
  129. <xsl:when test="title">
  130. <xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
  131. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  132. </xsl:apply-templates>
  133. </xsl:when>
  134. <xsl:otherwise>
  135. <xsl:call-template name="gentext">
  136. <xsl:with-param name="key" select="'Dedication'"/>
  137. </xsl:call-template>
  138. </xsl:otherwise>
  139. </xsl:choose>
  140. </xsl:template>
  141. <xsl:template match="colophon" mode="title.markup">
  142. <xsl:param name="allow-anchors" select="0"/>
  143. <xsl:choose>
  144. <xsl:when test="title">
  145. <xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
  146. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  147. </xsl:apply-templates>
  148. </xsl:when>
  149. <xsl:otherwise>
  150. <xsl:call-template name="gentext">
  151. <xsl:with-param name="key" select="'Colophon'"/>
  152. </xsl:call-template>
  153. </xsl:otherwise>
  154. </xsl:choose>
  155. </xsl:template>
  156. <xsl:template match="article" mode="title.markup">
  157. <xsl:param name="allow-anchors" select="0"/>
  158. <xsl:variable name="title" select="(artheader/title
  159. |articleinfo/title
  160. |info/title
  161. |title)[1]"/>
  162. <xsl:apply-templates select="$title" mode="title.markup">
  163. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  164. </xsl:apply-templates>
  165. </xsl:template>
  166. <xsl:template match="reference" mode="title.markup">
  167. <xsl:param name="allow-anchors" select="0"/>
  168. <xsl:apply-templates select="(referenceinfo/title|docinfo/title|info/title|title)[1]"
  169. mode="title.markup">
  170. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  171. </xsl:apply-templates>
  172. </xsl:template>
  173. <xsl:template match="refentry" mode="title.markup">
  174. <xsl:param name="allow-anchors" select="0"/>
  175. <xsl:variable name="refmeta" select=".//refmeta"/>
  176. <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
  177. <xsl:variable name="refnamediv" select=".//refnamediv"/>
  178. <xsl:variable name="refname" select="$refnamediv//refname"/>
  179. <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
  180. <xsl:variable name="title">
  181. <xsl:choose>
  182. <xsl:when test="$refentrytitle">
  183. <xsl:apply-templates select="$refentrytitle[1]" mode="title.markup"/>
  184. </xsl:when>
  185. <xsl:when test="$refdesc">
  186. <xsl:apply-templates select="$refdesc" mode="title.markup"/>
  187. </xsl:when>
  188. <xsl:when test="$refname">
  189. <xsl:apply-templates select="$refname[1]" mode="title.markup"/>
  190. </xsl:when>
  191. <xsl:otherwise>REFENTRY WITHOUT TITLE???</xsl:otherwise>
  192. </xsl:choose>
  193. </xsl:variable>
  194. <xsl:copy-of select="$title"/>
  195. </xsl:template>
  196. <xsl:template match="refentrytitle|refname|refdescriptor" mode="title.markup">
  197. <xsl:param name="allow-anchors" select="0"/>
  198. <xsl:choose>
  199. <xsl:when test="$allow-anchors != 0">
  200. <xsl:apply-templates/>
  201. </xsl:when>
  202. <xsl:otherwise>
  203. <xsl:apply-templates mode="no.anchor.mode"/>
  204. </xsl:otherwise>
  205. </xsl:choose>
  206. </xsl:template>
  207. <xsl:template match="section
  208. |sect1|sect2|sect3|sect4|sect5
  209. |refsect1|refsect2|refsect3|refsection
  210. |simplesect"
  211. mode="title.markup">
  212. <xsl:param name="allow-anchors" select="0"/>
  213. <xsl:variable name="title" select="(info/title
  214. |sectioninfo/title
  215. |sect1info/title
  216. |sect2info/title
  217. |sect3info/title
  218. |sect4info/title
  219. |sect5info/title
  220. |refsect1info/title
  221. |refsect2info/title
  222. |refsect3info/title
  223. |refsectioninfo/title
  224. |title)[1]"/>
  225. <xsl:apply-templates select="$title" mode="title.markup">
  226. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  227. </xsl:apply-templates>
  228. </xsl:template>
  229. <xsl:template match="bridgehead" mode="title.markup">
  230. <xsl:apply-templates mode="title.markup"/>
  231. </xsl:template>
  232. <xsl:template match="refsynopsisdiv" mode="title.markup">
  233. <xsl:param name="allow-anchors" select="0"/>
  234. <xsl:choose>
  235. <xsl:when test="title">
  236. <xsl:apply-templates select="title" mode="title.markup">
  237. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  238. </xsl:apply-templates>
  239. </xsl:when>
  240. <xsl:otherwise>
  241. <xsl:call-template name="gentext">
  242. <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
  243. </xsl:call-template>
  244. </xsl:otherwise>
  245. </xsl:choose>
  246. </xsl:template>
  247. <xsl:template match="bibliography" mode="title.markup">
  248. <xsl:param name="allow-anchors" select="0"/>
  249. <xsl:variable name="title" select="(bibliographyinfo/title|info/title|title)[1]"/>
  250. <xsl:choose>
  251. <xsl:when test="$title">
  252. <xsl:apply-templates select="$title" mode="title.markup">
  253. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  254. </xsl:apply-templates>
  255. </xsl:when>
  256. <xsl:otherwise>
  257. <xsl:call-template name="gentext">
  258. <xsl:with-param name="key" select="'Bibliography'"/>
  259. </xsl:call-template>
  260. </xsl:otherwise>
  261. </xsl:choose>
  262. </xsl:template>
  263. <xsl:template match="glossary" mode="title.markup">
  264. <xsl:param name="allow-anchors" select="0"/>
  265. <xsl:variable name="title" select="(glossaryinfo/title|info/title|title)[1]"/>
  266. <xsl:choose>
  267. <xsl:when test="$title">
  268. <xsl:apply-templates select="$title" mode="title.markup">
  269. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  270. </xsl:apply-templates>
  271. </xsl:when>
  272. <xsl:otherwise>
  273. <xsl:call-template name="gentext.element.name">
  274. <xsl:with-param name="element.name" select="local-name(.)"/>
  275. </xsl:call-template>
  276. </xsl:otherwise>
  277. </xsl:choose>
  278. </xsl:template>
  279. <xsl:template match="glossdiv" mode="title.markup">
  280. <xsl:param name="allow-anchors" select="0"/>
  281. <xsl:variable name="title" select="(info/title|title)[1]"/>
  282. <xsl:choose>
  283. <xsl:when test="$title">
  284. <xsl:apply-templates select="$title" mode="title.markup">
  285. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  286. </xsl:apply-templates>
  287. </xsl:when>
  288. <xsl:otherwise>
  289. <xsl:message>ERROR: glossdiv missing its required title</xsl:message>
  290. </xsl:otherwise>
  291. </xsl:choose>
  292. </xsl:template>
  293. <xsl:template match="glossentry" mode="title.markup">
  294. <xsl:param name="allow-anchors" select="0"/>
  295. <xsl:apply-templates select="glossterm" mode="title.markup">
  296. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  297. </xsl:apply-templates>
  298. </xsl:template>
  299. <xsl:template match="glossterm" mode="title.markup">
  300. <xsl:param name="allow-anchors" select="0"/>
  301. <xsl:choose>
  302. <xsl:when test="$allow-anchors != 0">
  303. <xsl:apply-templates/>
  304. </xsl:when>
  305. <xsl:otherwise>
  306. <xsl:apply-templates mode="no.anchor.mode"/>
  307. </xsl:otherwise>
  308. </xsl:choose>
  309. </xsl:template>
  310. <xsl:template match="index" mode="title.markup">
  311. <xsl:param name="allow-anchors" select="0"/>
  312. <xsl:variable name="title" select="(indexinfo/title|info/title|title)[1]"/>
  313. <xsl:choose>
  314. <xsl:when test="$title">
  315. <xsl:apply-templates select="$title" mode="title.markup">
  316. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  317. </xsl:apply-templates>
  318. </xsl:when>
  319. <xsl:otherwise>
  320. <xsl:call-template name="gentext">
  321. <xsl:with-param name="key" select="'Index'"/>
  322. </xsl:call-template>
  323. </xsl:otherwise>
  324. </xsl:choose>
  325. </xsl:template>
  326. <xsl:template match="setindex" mode="title.markup">
  327. <xsl:param name="allow-anchors" select="0"/>
  328. <xsl:variable name="title" select="(setindexinfo/title|info/title|title)[1]"/>
  329. <xsl:choose>
  330. <xsl:when test="$title">
  331. <xsl:apply-templates select="$title" mode="title.markup">
  332. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  333. </xsl:apply-templates>
  334. </xsl:when>
  335. <xsl:otherwise>
  336. <xsl:call-template name="gentext">
  337. <xsl:with-param name="key" select="'SetIndex'"/>
  338. </xsl:call-template>
  339. </xsl:otherwise>
  340. </xsl:choose>
  341. </xsl:template>
  342. <xsl:template match="figure|example|equation" mode="title.markup">
  343. <xsl:param name="allow-anchors" select="0"/>
  344. <xsl:apply-templates select="title|info/title" mode="title.markup">
  345. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  346. </xsl:apply-templates>
  347. </xsl:template>
  348. <xsl:template match="table" mode="title.markup">
  349. <xsl:param name="allow-anchors" select="0"/>
  350. <xsl:apply-templates select="(title|caption)[1]" mode="title.markup">
  351. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  352. </xsl:apply-templates>
  353. </xsl:template>
  354. <xsl:template match="procedure" mode="title.markup">
  355. <xsl:param name="allow-anchors" select="0"/>
  356. <xsl:apply-templates select="title" mode="title.markup">
  357. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  358. </xsl:apply-templates>
  359. </xsl:template>
  360. <xsl:template match="task" mode="title.markup">
  361. <xsl:param name="allow-anchors" select="0"/>
  362. <xsl:apply-templates select="title" mode="title.markup">
  363. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  364. </xsl:apply-templates>
  365. </xsl:template>
  366. <xsl:template match="sidebar" mode="title.markup">
  367. <xsl:param name="allow-anchors" select="0"/>
  368. <xsl:apply-templates select="(info/title|sidebarinfo/title|title)[1]"
  369. mode="title.markup">
  370. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  371. </xsl:apply-templates>
  372. </xsl:template>
  373. <xsl:template match="abstract" mode="title.markup">
  374. <xsl:param name="allow-anchors" select="0"/>
  375. <xsl:choose>
  376. <xsl:when test="title|info/title">
  377. <xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
  378. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  379. </xsl:apply-templates>
  380. </xsl:when>
  381. <xsl:otherwise>
  382. <xsl:call-template name="gentext">
  383. <xsl:with-param name="key" select="'Abstract'"/>
  384. </xsl:call-template>
  385. </xsl:otherwise>
  386. </xsl:choose>
  387. </xsl:template>
  388. <xsl:template match="caution|tip|warning|important|note" mode="title.markup">
  389. <xsl:param name="allow-anchors" select="0"/>
  390. <xsl:variable name="title" select="(title|info/title)[1]"/>
  391. <xsl:choose>
  392. <xsl:when test="$title">
  393. <xsl:apply-templates select="$title" mode="title.markup">
  394. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  395. </xsl:apply-templates>
  396. </xsl:when>
  397. <xsl:otherwise>
  398. <xsl:call-template name="gentext">
  399. <xsl:with-param name="key">
  400. <xsl:choose>
  401. <xsl:when test="local-name(.)='note'">Note</xsl:when>
  402. <xsl:when test="local-name(.)='important'">Important</xsl:when>
  403. <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
  404. <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
  405. <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
  406. </xsl:choose>
  407. </xsl:with-param>
  408. </xsl:call-template>
  409. </xsl:otherwise>
  410. </xsl:choose>
  411. </xsl:template>
  412. <xsl:template match="question" mode="title.markup">
  413. <!-- questions don't have titles -->
  414. <xsl:text>Question</xsl:text>
  415. </xsl:template>
  416. <xsl:template match="answer" mode="title.markup">
  417. <!-- answers don't have titles -->
  418. <xsl:text>Answer</xsl:text>
  419. </xsl:template>
  420. <xsl:template match="qandaentry" mode="title.markup">
  421. <!-- qandaentrys are represented by the first question in them -->
  422. <xsl:text>Question</xsl:text>
  423. </xsl:template>
  424. <xsl:template match="qandaset" mode="title.markup">
  425. <xsl:param name="allow-anchors" select="0"/>
  426. <xsl:variable name="title" select="(info/title|
  427. blockinfo/title|
  428. title)[1]"/>
  429. <xsl:choose>
  430. <xsl:when test="$title">
  431. <xsl:apply-templates select="$title" mode="title.markup">
  432. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  433. </xsl:apply-templates>
  434. </xsl:when>
  435. <xsl:otherwise>
  436. <xsl:call-template name="gentext">
  437. <xsl:with-param name="key" select="'QandASet'"/>
  438. </xsl:call-template>
  439. </xsl:otherwise>
  440. </xsl:choose>
  441. </xsl:template>
  442. <xsl:template match="legalnotice" mode="title.markup">
  443. <xsl:param name="allow-anchors" select="0"/>
  444. <xsl:choose>
  445. <xsl:when test="title">
  446. <xsl:apply-templates select="title" mode="title.markup">
  447. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  448. </xsl:apply-templates>
  449. </xsl:when>
  450. <xsl:otherwise>
  451. <xsl:call-template name="gentext">
  452. <xsl:with-param name="key" select="'LegalNotice'"/>
  453. </xsl:call-template>
  454. </xsl:otherwise>
  455. </xsl:choose>
  456. </xsl:template>
  457. <!-- ============================================================ -->
  458. <xsl:template match="*" mode="titleabbrev.markup">
  459. <xsl:param name="allow-anchors" select="0"/>
  460. <xsl:param name="verbose" select="1"/>
  461. <xsl:choose>
  462. <xsl:when test="titleabbrev">
  463. <xsl:apply-templates select="titleabbrev[1]" mode="title.markup">
  464. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  465. </xsl:apply-templates>
  466. </xsl:when>
  467. <xsl:otherwise>
  468. <xsl:apply-templates select="." mode="title.markup">
  469. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  470. <xsl:with-param name="verbose" select="$verbose"/>
  471. </xsl:apply-templates>
  472. </xsl:otherwise>
  473. </xsl:choose>
  474. </xsl:template>
  475. <xsl:template match="book|preface|chapter|appendix" mode="titleabbrev.markup">
  476. <xsl:param name="allow-anchors" select="0"/>
  477. <xsl:param name="verbose" select="1"/>
  478. <xsl:variable name="titleabbrev" select="(docinfo/titleabbrev
  479. |bookinfo/titleabbrev
  480. |info/titleabbrev
  481. |prefaceinfo/titleabbrev
  482. |chapterinfo/titleabbrev
  483. |appendixinfo/titleabbrev
  484. |titleabbrev)[1]"/>
  485. <xsl:choose>
  486. <xsl:when test="$titleabbrev">
  487. <xsl:apply-templates select="$titleabbrev" mode="title.markup">
  488. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  489. </xsl:apply-templates>
  490. </xsl:when>
  491. <xsl:otherwise>
  492. <xsl:apply-templates select="." mode="title.markup">
  493. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  494. <xsl:with-param name="verbose" select="$verbose"/>
  495. </xsl:apply-templates>
  496. </xsl:otherwise>
  497. </xsl:choose>
  498. </xsl:template>
  499. <xsl:template match="article" mode="titleabbrev.markup">
  500. <xsl:param name="allow-anchors" select="0"/>
  501. <xsl:param name="verbose" select="1"/>
  502. <xsl:variable name="titleabbrev" select="(artheader/titleabbrev
  503. |articleinfo/titleabbrev
  504. |info/titleabbrev
  505. |titleabbrev)[1]"/>
  506. <xsl:choose>
  507. <xsl:when test="$titleabbrev">
  508. <xsl:apply-templates select="$titleabbrev" mode="title.markup">
  509. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  510. </xsl:apply-templates>
  511. </xsl:when>
  512. <xsl:otherwise>
  513. <xsl:apply-templates select="." mode="title.markup">
  514. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  515. <xsl:with-param name="verbose" select="$verbose"/>
  516. </xsl:apply-templates>
  517. </xsl:otherwise>
  518. </xsl:choose>
  519. </xsl:template>
  520. <xsl:template match="section
  521. |sect1|sect2|sect3|sect4|sect5
  522. |refsect1|refsect2|refsect3
  523. |simplesect"
  524. mode="titleabbrev.markup">
  525. <xsl:param name="allow-anchors" select="0"/>
  526. <xsl:param name="verbose" select="1"/>
  527. <xsl:variable name="titleabbrev" select="(info/titleabbrev
  528. |sectioninfo/titleabbrev
  529. |sect1info/titleabbrev
  530. |sect2info/titleabbrev
  531. |sect3info/titleabbrev
  532. |sect4info/titleabbrev
  533. |sect5info/titleabbrev
  534. |refsect1info/titleabbrev
  535. |refsect2info/titleabbrev
  536. |refsect3info/titleabbrev
  537. |titleabbrev)[1]"/>
  538. <xsl:choose>
  539. <xsl:when test="$titleabbrev">
  540. <xsl:apply-templates select="$titleabbrev" mode="title.markup">
  541. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  542. </xsl:apply-templates>
  543. </xsl:when>
  544. <xsl:otherwise>
  545. <xsl:apply-templates select="." mode="title.markup">
  546. <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
  547. <xsl:with-param name="verbose" select="$verbose"/>
  548. </xsl:apply-templates>
  549. </xsl:otherwise>
  550. </xsl:choose>
  551. </xsl:template>
  552. <xsl:template match="titleabbrev" mode="title.markup">
  553. <xsl:param name="allow-anchors" select="0"/>
  554. <xsl:choose>
  555. <xsl:when test="$allow-anchors != 0">
  556. <xsl:apply-templates/>
  557. </xsl:when>
  558. <xsl:otherwise>
  559. <xsl:apply-templates mode="no.anchor.mode"/>
  560. </xsl:otherwise>
  561. </xsl:choose>
  562. </xsl:template>
  563. <!-- ============================================================ -->
  564. <xsl:template match="*" mode="no.anchor.mode">
  565. <!-- Switch to normal mode if no links -->
  566. <xsl:choose>
  567. <xsl:when test="descendant-or-self::footnote or
  568. descendant-or-self::anchor or
  569. descendant-or-self::ulink or
  570. descendant-or-self::link or
  571. descendant-or-self::olink or
  572. descendant-or-self::xref or
  573. descendant-or-self::indexterm">
  574. <xsl:apply-templates mode="no.anchor.mode"/>
  575. </xsl:when>
  576. <xsl:otherwise>
  577. <xsl:apply-templates select="."/>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. </xsl:template>
  581. <xsl:template match="footnote" mode="no.anchor.mode">
  582. <!-- nop, suppressed -->
  583. </xsl:template>
  584. <xsl:template match="anchor" mode="no.anchor.mode">
  585. <!-- nop, suppressed -->
  586. </xsl:template>
  587. <xsl:template match="ulink" mode="no.anchor.mode">
  588. <xsl:apply-templates/>
  589. </xsl:template>
  590. <xsl:template match="link" mode="no.anchor.mode">
  591. <xsl:apply-templates/>
  592. </xsl:template>
  593. <xsl:template match="olink" mode="no.anchor.mode">
  594. <xsl:apply-templates/>
  595. </xsl:template>
  596. <xsl:template match="indexterm" mode="no.anchor.mode">
  597. <!-- nop, suppressed -->
  598. </xsl:template>
  599. <xsl:template match="xref" mode="no.anchor.mode">
  600. <xsl:variable name="targets" select="key('id',@linkend)"/>
  601. <xsl:variable name="target" select="$targets[1]"/>
  602. <xsl:variable name="refelem" select="local-name($target)"/>
  603. <xsl:call-template name="check.id.unique">
  604. <xsl:with-param name="linkend" select="@linkend"/>
  605. </xsl:call-template>
  606. <xsl:choose>
  607. <xsl:when test="count($target) = 0">
  608. <xsl:message>
  609. <xsl:text>XRef to nonexistent id: </xsl:text>
  610. <xsl:value-of select="@linkend"/>
  611. </xsl:message>
  612. <xsl:text>???</xsl:text>
  613. </xsl:when>
  614. <xsl:when test="@endterm">
  615. <xsl:variable name="etargets" select="key('id',@endterm)"/>
  616. <xsl:variable name="etarget" select="$etargets[1]"/>
  617. <xsl:choose>
  618. <xsl:when test="count($etarget) = 0">
  619. <xsl:message>
  620. <xsl:value-of select="count($etargets)"/>
  621. <xsl:text>Endterm points to nonexistent ID: </xsl:text>
  622. <xsl:value-of select="@endterm"/>
  623. </xsl:message>
  624. <xsl:text>???</xsl:text>
  625. </xsl:when>
  626. <xsl:otherwise>
  627. <xsl:apply-templates select="$etarget" mode="endterm"/>
  628. </xsl:otherwise>
  629. </xsl:choose>
  630. </xsl:when>
  631. <xsl:when test="$target/@xreflabel">
  632. <xsl:call-template name="xref.xreflabel">
  633. <xsl:with-param name="target" select="$target"/>
  634. </xsl:call-template>
  635. </xsl:when>
  636. <xsl:otherwise>
  637. <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
  638. <xsl:apply-templates select="$target" mode="xref-to">
  639. <xsl:with-param name="referrer" select="."/>
  640. <xsl:with-param name="xrefstyle">
  641. <xsl:choose>
  642. <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
  643. <xsl:value-of select="@role"/>
  644. </xsl:when>
  645. <xsl:otherwise>
  646. <xsl:value-of select="@xrefstyle"/>
  647. </xsl:otherwise>
  648. </xsl:choose>
  649. </xsl:with-param>
  650. </xsl:apply-templates>
  651. <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
  652. </xsl:otherwise>
  653. </xsl:choose>
  654. </xsl:template>
  655. <!-- ============================================================ -->
  656. </xsl:stylesheet>