inline.xsl 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. <?xml version='1.0'?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv|
  4. parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
  5. parent::glossary|parent::glossdiv|parent::important|parent::index|
  6. parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
  7. parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
  8. parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
  9. parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
  10. parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
  11. parent::sect5|parent::section|parent::setindex|parent::sidebar|
  12. parent::simplesect|parent::taskprerequisites|parent::taskrelated|
  13. parent::tasksummary|parent::warning">
  14. ]>
  15. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  16. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  17. xmlns:xlink='http://www.w3.org/1999/xlink'
  18. exclude-result-prefixes="xlink"
  19. version='1.0'>
  20. <!-- ********************************************************************
  21. $Id$
  22. ********************************************************************
  23. This file is part of the XSL DocBook Stylesheet distribution.
  24. See ../README or http://docbook.sf.net/release/xsl/current/ for
  25. copyright and other information.
  26. ******************************************************************** -->
  27. <xsl:template name="simple.xlink">
  28. <xsl:param name="node" select="."/>
  29. <xsl:param name="content">
  30. <xsl:apply-templates/>
  31. </xsl:param>
  32. <xsl:param name="linkend" select="$node/@linkend"/>
  33. <xsl:param name="xhref" select="$node/@xlink:href"/>
  34. <xsl:choose>
  35. <xsl:when test="$xhref
  36. and (not($node/@xlink:type) or
  37. $node/@xlink:type='simple')">
  38. <!-- Is it a local idref? -->
  39. <xsl:variable name="is.idref">
  40. <xsl:choose>
  41. <!-- if the href starts with # and does not contain an "(" -->
  42. <!-- or if the href starts with #xpointer(id(, it's just an ID -->
  43. <xsl:when test="starts-with($xhref,'#')
  44. and (not(contains($xhref,'&#40;'))
  45. or starts-with($xhref,
  46. '#xpointer&#40;id&#40;'))">1</xsl:when>
  47. <xsl:otherwise>0</xsl:otherwise>
  48. </xsl:choose>
  49. </xsl:variable>
  50. <!-- Is it an olink ? -->
  51. <xsl:variable name="is.olink">
  52. <xsl:choose>
  53. <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
  54. <!-- and if the href contains # -->
  55. <xsl:when test="contains($xhref,'#') and
  56. @xlink:role = $xolink.role">1</xsl:when>
  57. <xsl:otherwise>0</xsl:otherwise>
  58. </xsl:choose>
  59. </xsl:variable>
  60. <xsl:choose>
  61. <xsl:when test="$is.idref = 1">
  62. <xsl:variable name="idref">
  63. <xsl:call-template name="xpointer.idref">
  64. <xsl:with-param name="xpointer" select="$xhref"/>
  65. </xsl:call-template>
  66. </xsl:variable>
  67. <xsl:variable name="targets" select="key('id',$idref)"/>
  68. <xsl:variable name="target" select="$targets[1]"/>
  69. <xsl:call-template name="check.id.unique">
  70. <xsl:with-param name="linkend" select="$idref"/>
  71. </xsl:call-template>
  72. <xsl:choose>
  73. <xsl:when test="count($target) = 0">
  74. <xsl:message>
  75. <xsl:text>XLink to nonexistent id: </xsl:text>
  76. <xsl:value-of select="$idref"/>
  77. </xsl:message>
  78. <xsl:copy-of select="$content"/>
  79. </xsl:when>
  80. <xsl:otherwise>
  81. <fo:basic-link internal-destination="{$idref}">
  82. <xsl:copy-of select="$content"/>
  83. </fo:basic-link>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </xsl:when>
  87. <xsl:when test="$is.olink = 1">
  88. <xsl:call-template name="olink">
  89. <xsl:with-param name="content" select="$content"/>
  90. </xsl:call-template>
  91. </xsl:when>
  92. <!-- otherwise it's a URI -->
  93. <xsl:otherwise>
  94. <fo:basic-link external-destination="url({$xhref})">
  95. <xsl:copy-of select="$content"/>
  96. </fo:basic-link>
  97. </xsl:otherwise>
  98. </xsl:choose>
  99. </xsl:when>
  100. <xsl:when test="$linkend">
  101. <xsl:variable name="targets" select="key('id',$linkend)"/>
  102. <xsl:variable name="target" select="$targets[1]"/>
  103. <xsl:call-template name="check.id.unique">
  104. <xsl:with-param name="linkend" select="$linkend"/>
  105. </xsl:call-template>
  106. <xsl:choose>
  107. <xsl:when test="count($target) = 0">
  108. <xsl:message>
  109. <xsl:text>XLink to nonexistent id: </xsl:text>
  110. <xsl:value-of select="$linkend"/>
  111. </xsl:message>
  112. <xsl:copy-of select="$content"/>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <fo:basic-link internal-destination="{$linkend}">
  116. <xsl:copy-of select="$content"/>
  117. </fo:basic-link>
  118. </xsl:otherwise>
  119. </xsl:choose>
  120. </xsl:when>
  121. <xsl:otherwise>
  122. <xsl:copy-of select="$content"/>
  123. </xsl:otherwise>
  124. </xsl:choose>
  125. </xsl:template>
  126. <xsl:template name="inline.charseq">
  127. <xsl:param name="content">
  128. <xsl:call-template name="simple.xlink">
  129. <xsl:with-param name="content">
  130. <xsl:apply-templates/>
  131. </xsl:with-param>
  132. </xsl:call-template>
  133. </xsl:param>
  134. <xsl:choose>
  135. <xsl:when test="@dir">
  136. <fo:inline>
  137. <xsl:attribute name="direction">
  138. <xsl:choose>
  139. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  140. <xsl:otherwise>rtl</xsl:otherwise>
  141. </xsl:choose>
  142. </xsl:attribute>
  143. <xsl:copy-of select="$content"/>
  144. </fo:inline>
  145. </xsl:when>
  146. <xsl:otherwise>
  147. <xsl:copy-of select="$content"/>
  148. </xsl:otherwise>
  149. </xsl:choose>
  150. </xsl:template>
  151. <xsl:template name="inline.monoseq">
  152. <xsl:param name="content">
  153. <xsl:call-template name="simple.xlink">
  154. <xsl:with-param name="content">
  155. <xsl:apply-templates/>
  156. </xsl:with-param>
  157. </xsl:call-template>
  158. </xsl:param>
  159. <fo:inline xsl:use-attribute-sets="monospace.properties">
  160. <xsl:if test="@dir">
  161. <xsl:attribute name="direction">
  162. <xsl:choose>
  163. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  164. <xsl:otherwise>rtl</xsl:otherwise>
  165. </xsl:choose>
  166. </xsl:attribute>
  167. </xsl:if>
  168. <xsl:copy-of select="$content"/>
  169. </fo:inline>
  170. </xsl:template>
  171. <xsl:template name="inline.boldseq">
  172. <xsl:param name="content">
  173. <xsl:call-template name="simple.xlink">
  174. <xsl:with-param name="content">
  175. <xsl:apply-templates/>
  176. </xsl:with-param>
  177. </xsl:call-template>
  178. </xsl:param>
  179. <fo:inline font-weight="bold">
  180. <xsl:if test="@dir">
  181. <xsl:attribute name="direction">
  182. <xsl:choose>
  183. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  184. <xsl:otherwise>rtl</xsl:otherwise>
  185. </xsl:choose>
  186. </xsl:attribute>
  187. </xsl:if>
  188. <xsl:copy-of select="$content"/>
  189. </fo:inline>
  190. </xsl:template>
  191. <xsl:template name="inline.italicseq">
  192. <xsl:param name="content">
  193. <xsl:call-template name="simple.xlink">
  194. <xsl:with-param name="content">
  195. <xsl:apply-templates/>
  196. </xsl:with-param>
  197. </xsl:call-template>
  198. </xsl:param>
  199. <fo:inline font-style="italic">
  200. <xsl:call-template name="anchor"/>
  201. <xsl:if test="@dir">
  202. <xsl:attribute name="direction">
  203. <xsl:choose>
  204. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  205. <xsl:otherwise>rtl</xsl:otherwise>
  206. </xsl:choose>
  207. </xsl:attribute>
  208. </xsl:if>
  209. <xsl:copy-of select="$content"/>
  210. </fo:inline>
  211. </xsl:template>
  212. <xsl:template name="inline.boldmonoseq">
  213. <xsl:param name="content">
  214. <xsl:call-template name="simple.xlink">
  215. <xsl:with-param name="content">
  216. <xsl:apply-templates/>
  217. </xsl:with-param>
  218. </xsl:call-template>
  219. </xsl:param>
  220. <fo:inline font-weight="bold" xsl:use-attribute-sets="monospace.properties">
  221. <xsl:call-template name="anchor"/>
  222. <xsl:if test="@dir">
  223. <xsl:attribute name="direction">
  224. <xsl:choose>
  225. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  226. <xsl:otherwise>rtl</xsl:otherwise>
  227. </xsl:choose>
  228. </xsl:attribute>
  229. </xsl:if>
  230. <xsl:copy-of select="$content"/>
  231. </fo:inline>
  232. </xsl:template>
  233. <xsl:template name="inline.italicmonoseq">
  234. <xsl:param name="content">
  235. <xsl:call-template name="simple.xlink">
  236. <xsl:with-param name="content">
  237. <xsl:apply-templates/>
  238. </xsl:with-param>
  239. </xsl:call-template>
  240. </xsl:param>
  241. <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
  242. <xsl:call-template name="anchor"/>
  243. <xsl:if test="@dir">
  244. <xsl:attribute name="direction">
  245. <xsl:choose>
  246. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  247. <xsl:otherwise>rtl</xsl:otherwise>
  248. </xsl:choose>
  249. </xsl:attribute>
  250. </xsl:if>
  251. <xsl:copy-of select="$content"/>
  252. </fo:inline>
  253. </xsl:template>
  254. <xsl:template name="inline.superscriptseq">
  255. <xsl:param name="content">
  256. <xsl:call-template name="simple.xlink">
  257. <xsl:with-param name="content">
  258. <xsl:apply-templates/>
  259. </xsl:with-param>
  260. </xsl:call-template>
  261. </xsl:param>
  262. <fo:inline xsl:use-attribute-sets="superscript.properties">
  263. <xsl:call-template name="anchor"/>
  264. <xsl:if test="@dir">
  265. <xsl:attribute name="direction">
  266. <xsl:choose>
  267. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  268. <xsl:otherwise>rtl</xsl:otherwise>
  269. </xsl:choose>
  270. </xsl:attribute>
  271. </xsl:if>
  272. <xsl:choose>
  273. <xsl:when test="$fop.extensions != 0">
  274. <xsl:attribute name="vertical-align">super</xsl:attribute>
  275. </xsl:when>
  276. <xsl:otherwise>
  277. <xsl:attribute name="baseline-shift">super</xsl:attribute>
  278. </xsl:otherwise>
  279. </xsl:choose>
  280. <xsl:copy-of select="$content"/>
  281. </fo:inline>
  282. </xsl:template>
  283. <xsl:template name="inline.subscriptseq">
  284. <xsl:param name="content">
  285. <xsl:call-template name="simple.xlink">
  286. <xsl:with-param name="content">
  287. <xsl:apply-templates/>
  288. </xsl:with-param>
  289. </xsl:call-template>
  290. </xsl:param>
  291. <fo:inline xsl:use-attribute-sets="subscript.properties">
  292. <xsl:call-template name="anchor"/>
  293. <xsl:if test="@dir">
  294. <xsl:attribute name="direction">
  295. <xsl:choose>
  296. <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
  297. <xsl:otherwise>rtl</xsl:otherwise>
  298. </xsl:choose>
  299. </xsl:attribute>
  300. </xsl:if>
  301. <xsl:choose>
  302. <xsl:when test="$fop.extensions != 0">
  303. <xsl:attribute name="vertical-align">sub</xsl:attribute>
  304. </xsl:when>
  305. <xsl:otherwise>
  306. <xsl:attribute name="baseline-shift">sub</xsl:attribute>
  307. </xsl:otherwise>
  308. </xsl:choose>
  309. <xsl:copy-of select="$content"/>
  310. </fo:inline>
  311. </xsl:template>
  312. <!-- ==================================================================== -->
  313. <!-- some special cases -->
  314. <xsl:template match="author">
  315. <xsl:call-template name="simple.xlink">
  316. <xsl:with-param name="content">
  317. <xsl:call-template name="person.name"/>
  318. </xsl:with-param>
  319. </xsl:call-template>
  320. </xsl:template>
  321. <xsl:template match="editor">
  322. <xsl:call-template name="simple.xlink">
  323. <xsl:with-param name="content">
  324. <xsl:call-template name="person.name"/>
  325. </xsl:with-param>
  326. </xsl:call-template>
  327. </xsl:template>
  328. <xsl:template match="othercredit">
  329. <xsl:call-template name="simple.xlink">
  330. <xsl:with-param name="content">
  331. <xsl:call-template name="person.name"/>
  332. </xsl:with-param>
  333. </xsl:call-template>
  334. </xsl:template>
  335. <xsl:template match="authorinitials">
  336. <xsl:call-template name="inline.charseq"/>
  337. </xsl:template>
  338. <!-- ==================================================================== -->
  339. <xsl:template match="accel">
  340. <xsl:call-template name="inline.charseq"/>
  341. </xsl:template>
  342. <xsl:template match="action">
  343. <xsl:call-template name="inline.charseq"/>
  344. </xsl:template>
  345. <xsl:template match="application">
  346. <xsl:call-template name="inline.charseq"/>
  347. </xsl:template>
  348. <xsl:template match="classname">
  349. <xsl:call-template name="inline.monoseq"/>
  350. </xsl:template>
  351. <xsl:template match="exceptionname">
  352. <xsl:call-template name="inline.monoseq"/>
  353. </xsl:template>
  354. <xsl:template match="interfacename">
  355. <xsl:call-template name="inline.monoseq"/>
  356. </xsl:template>
  357. <xsl:template match="methodname">
  358. <xsl:call-template name="inline.monoseq"/>
  359. </xsl:template>
  360. <xsl:template match="command">
  361. <xsl:call-template name="inline.boldseq"/>
  362. </xsl:template>
  363. <xsl:template match="computeroutput">
  364. <xsl:call-template name="inline.monoseq"/>
  365. </xsl:template>
  366. <xsl:template match="constant">
  367. <xsl:call-template name="inline.monoseq"/>
  368. </xsl:template>
  369. <xsl:template match="database">
  370. <xsl:call-template name="inline.charseq"/>
  371. </xsl:template>
  372. <xsl:template match="date">
  373. <!-- should this support locale-specific formatting? how? -->
  374. <xsl:call-template name="inline.charseq"/>
  375. </xsl:template>
  376. <xsl:template match="errorcode">
  377. <xsl:call-template name="inline.charseq"/>
  378. </xsl:template>
  379. <xsl:template match="errorname">
  380. <xsl:call-template name="inline.charseq"/>
  381. </xsl:template>
  382. <xsl:template match="errortype">
  383. <xsl:call-template name="inline.charseq"/>
  384. </xsl:template>
  385. <xsl:template match="errortext">
  386. <xsl:call-template name="inline.charseq"/>
  387. </xsl:template>
  388. <xsl:template match="envar">
  389. <xsl:call-template name="inline.monoseq"/>
  390. </xsl:template>
  391. <xsl:template match="filename">
  392. <xsl:call-template name="inline.monoseq"/>
  393. </xsl:template>
  394. <xsl:template match="function">
  395. <xsl:choose>
  396. <xsl:when test="$function.parens != '0'
  397. and (parameter or function or replaceable)">
  398. <xsl:variable name="nodes" select="text()|*"/>
  399. <xsl:call-template name="inline.monoseq">
  400. <xsl:with-param name="content">
  401. <xsl:call-template name="simple.xlink">
  402. <xsl:with-param name="content">
  403. <xsl:apply-templates select="$nodes[1]"/>
  404. </xsl:with-param>
  405. </xsl:call-template>
  406. </xsl:with-param>
  407. </xsl:call-template>
  408. <xsl:text>(</xsl:text>
  409. <xsl:apply-templates select="$nodes[position()>1]"/>
  410. <xsl:text>)</xsl:text>
  411. </xsl:when>
  412. <xsl:otherwise>
  413. <xsl:call-template name="inline.monoseq"/>
  414. </xsl:otherwise>
  415. </xsl:choose>
  416. </xsl:template>
  417. <xsl:template match="function/parameter" priority="2">
  418. <xsl:call-template name="inline.italicmonoseq"/>
  419. <xsl:if test="following-sibling::*">
  420. <xsl:text>, </xsl:text>
  421. </xsl:if>
  422. </xsl:template>
  423. <xsl:template match="function/replaceable" priority="2">
  424. <xsl:call-template name="inline.italicmonoseq"/>
  425. <xsl:if test="following-sibling::*">
  426. <xsl:text>, </xsl:text>
  427. </xsl:if>
  428. </xsl:template>
  429. <xsl:template match="guibutton">
  430. <xsl:call-template name="inline.charseq"/>
  431. </xsl:template>
  432. <xsl:template match="guiicon">
  433. <xsl:call-template name="inline.charseq"/>
  434. </xsl:template>
  435. <xsl:template match="guilabel">
  436. <xsl:call-template name="inline.charseq"/>
  437. </xsl:template>
  438. <xsl:template match="guimenu">
  439. <xsl:call-template name="inline.charseq"/>
  440. </xsl:template>
  441. <xsl:template match="guimenuitem">
  442. <xsl:call-template name="inline.charseq"/>
  443. </xsl:template>
  444. <xsl:template match="guisubmenu">
  445. <xsl:call-template name="inline.charseq"/>
  446. </xsl:template>
  447. <xsl:template match="hardware">
  448. <xsl:call-template name="inline.charseq"/>
  449. </xsl:template>
  450. <xsl:template match="interface">
  451. <xsl:call-template name="inline.charseq"/>
  452. </xsl:template>
  453. <xsl:template match="interfacedefinition">
  454. <xsl:call-template name="inline.charseq"/>
  455. </xsl:template>
  456. <xsl:template match="keycap">
  457. <xsl:call-template name="inline.boldseq"/>
  458. </xsl:template>
  459. <xsl:template match="keycode">
  460. <xsl:call-template name="inline.charseq"/>
  461. </xsl:template>
  462. <xsl:template match="keysym">
  463. <xsl:call-template name="inline.charseq"/>
  464. </xsl:template>
  465. <xsl:template match="literal">
  466. <xsl:call-template name="inline.monoseq"/>
  467. </xsl:template>
  468. <xsl:template match="code">
  469. <xsl:call-template name="inline.monoseq"/>
  470. </xsl:template>
  471. <xsl:template match="medialabel">
  472. <xsl:call-template name="inline.italicseq"/>
  473. </xsl:template>
  474. <xsl:template match="shortcut">
  475. <xsl:call-template name="inline.boldseq"/>
  476. </xsl:template>
  477. <xsl:template match="mousebutton">
  478. <xsl:call-template name="inline.charseq"/>
  479. </xsl:template>
  480. <xsl:template match="option">
  481. <xsl:call-template name="inline.monoseq"/>
  482. </xsl:template>
  483. <xsl:template match="package">
  484. <xsl:call-template name="inline.charseq"/>
  485. </xsl:template>
  486. <xsl:template match="parameter">
  487. <xsl:call-template name="inline.italicmonoseq"/>
  488. </xsl:template>
  489. <xsl:template match="property">
  490. <xsl:call-template name="inline.charseq"/>
  491. </xsl:template>
  492. <xsl:template match="prompt">
  493. <xsl:call-template name="inline.monoseq"/>
  494. </xsl:template>
  495. <xsl:template match="replaceable">
  496. <xsl:call-template name="inline.italicmonoseq"/>
  497. </xsl:template>
  498. <xsl:template match="returnvalue">
  499. <xsl:call-template name="inline.charseq"/>
  500. </xsl:template>
  501. <xsl:template match="structfield">
  502. <xsl:call-template name="inline.italicmonoseq"/>
  503. </xsl:template>
  504. <xsl:template match="structname">
  505. <xsl:call-template name="inline.charseq"/>
  506. </xsl:template>
  507. <xsl:template match="symbol">
  508. <xsl:call-template name="inline.charseq"/>
  509. </xsl:template>
  510. <xsl:template match="systemitem">
  511. <xsl:call-template name="inline.monoseq"/>
  512. </xsl:template>
  513. <xsl:template match="token">
  514. <xsl:call-template name="inline.charseq"/>
  515. </xsl:template>
  516. <xsl:template match="type">
  517. <xsl:call-template name="inline.charseq"/>
  518. </xsl:template>
  519. <xsl:template match="userinput">
  520. <xsl:call-template name="inline.boldmonoseq"/>
  521. </xsl:template>
  522. <xsl:template match="abbrev">
  523. <xsl:call-template name="inline.charseq"/>
  524. </xsl:template>
  525. <xsl:template match="acronym">
  526. <xsl:call-template name="inline.charseq"/>
  527. </xsl:template>
  528. <xsl:template match="citerefentry">
  529. <xsl:call-template name="inline.charseq"/>
  530. </xsl:template>
  531. <xsl:template match="citetitle">
  532. <xsl:choose>
  533. <xsl:when test="@pubwork = 'article'">
  534. <xsl:call-template name="gentext.startquote"/>
  535. <xsl:call-template name="inline.charseq"/>
  536. <xsl:call-template name="gentext.endquote"/>
  537. </xsl:when>
  538. <xsl:otherwise>
  539. <xsl:call-template name="inline.italicseq"/>
  540. </xsl:otherwise>
  541. </xsl:choose>
  542. </xsl:template>
  543. <xsl:template match="emphasis">
  544. <xsl:variable name="depth">
  545. <xsl:call-template name="dot.count">
  546. <xsl:with-param name="string">
  547. <xsl:number level="multiple"/>
  548. </xsl:with-param>
  549. </xsl:call-template>
  550. </xsl:variable>
  551. <xsl:choose>
  552. <xsl:when test="@role='bold' or @role='strong'">
  553. <xsl:call-template name="inline.boldseq"/>
  554. </xsl:when>
  555. <xsl:when test="@role='underline'">
  556. <fo:inline text-decoration="underline">
  557. <xsl:call-template name="inline.charseq"/>
  558. </fo:inline>
  559. </xsl:when>
  560. <xsl:when test="@role='strikethrough'">
  561. <fo:inline text-decoration="line-through">
  562. <xsl:call-template name="inline.charseq"/>
  563. </fo:inline>
  564. </xsl:when>
  565. <xsl:otherwise>
  566. <xsl:choose>
  567. <xsl:when test="$depth mod 2 = 1">
  568. <fo:inline font-style="normal">
  569. <xsl:apply-templates/>
  570. </fo:inline>
  571. </xsl:when>
  572. <xsl:otherwise>
  573. <xsl:call-template name="inline.italicseq"/>
  574. </xsl:otherwise>
  575. </xsl:choose>
  576. </xsl:otherwise>
  577. </xsl:choose>
  578. </xsl:template>
  579. <xsl:template match="foreignphrase">
  580. <xsl:call-template name="inline.italicseq"/>
  581. </xsl:template>
  582. <xsl:template match="markup">
  583. <xsl:call-template name="inline.charseq"/>
  584. </xsl:template>
  585. <xsl:template match="phrase">
  586. <xsl:call-template name="inline.charseq"/>
  587. </xsl:template>
  588. <xsl:template match="quote">
  589. <xsl:variable name="depth">
  590. <xsl:call-template name="dot.count">
  591. <xsl:with-param name="string"><xsl:number level="multiple"/></xsl:with-param>
  592. </xsl:call-template>
  593. </xsl:variable>
  594. <xsl:choose>
  595. <xsl:when test="$depth mod 2 = 0">
  596. <xsl:call-template name="gentext.startquote"/>
  597. <xsl:call-template name="inline.charseq"/>
  598. <xsl:call-template name="gentext.endquote"/>
  599. </xsl:when>
  600. <xsl:otherwise>
  601. <xsl:call-template name="gentext.nestedstartquote"/>
  602. <xsl:call-template name="inline.charseq"/>
  603. <xsl:call-template name="gentext.nestedendquote"/>
  604. </xsl:otherwise>
  605. </xsl:choose>
  606. </xsl:template>
  607. <xsl:template match="varname">
  608. <xsl:call-template name="inline.monoseq"/>
  609. </xsl:template>
  610. <xsl:template match="wordasword">
  611. <xsl:call-template name="inline.italicseq"/>
  612. </xsl:template>
  613. <xsl:template match="lineannotation">
  614. <fo:inline font-style="italic">
  615. <xsl:call-template name="inline.charseq"/>
  616. </fo:inline>
  617. </xsl:template>
  618. <xsl:template match="superscript">
  619. <xsl:call-template name="inline.superscriptseq"/>
  620. </xsl:template>
  621. <xsl:template match="subscript">
  622. <xsl:call-template name="inline.subscriptseq"/>
  623. </xsl:template>
  624. <xsl:template match="trademark">
  625. <xsl:call-template name="inline.charseq"/>
  626. <xsl:choose>
  627. <xsl:when test="@class = 'copyright'
  628. or @class = 'registered'">
  629. <xsl:call-template name="dingbat">
  630. <xsl:with-param name="dingbat" select="@class"/>
  631. </xsl:call-template>
  632. </xsl:when>
  633. <xsl:when test="@class = 'service'">
  634. <xsl:call-template name="inline.superscriptseq">
  635. <xsl:with-param name="content" select="'SM'"/>
  636. </xsl:call-template>
  637. </xsl:when>
  638. <xsl:otherwise>
  639. <xsl:call-template name="dingbat">
  640. <xsl:with-param name="dingbat" select="'trademark'"/>
  641. </xsl:call-template>
  642. </xsl:otherwise>
  643. </xsl:choose>
  644. </xsl:template>
  645. <xsl:template match="firstterm">
  646. <xsl:call-template name="glossterm">
  647. <xsl:with-param name="firstterm" select="1"/>
  648. </xsl:call-template>
  649. </xsl:template>
  650. <xsl:template match="glossterm" name="glossterm">
  651. <xsl:param name="firstterm" select="0"/>
  652. <xsl:choose>
  653. <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
  654. <xsl:variable name="targets" select="key('id',@linkend)"/>
  655. <xsl:variable name="target" select="$targets[1]"/>
  656. <xsl:choose>
  657. <xsl:when test="$target">
  658. <fo:basic-link internal-destination="{@linkend}"
  659. xsl:use-attribute-sets="xref.properties">
  660. <xsl:call-template name="inline.italicseq"/>
  661. </fo:basic-link>
  662. </xsl:when>
  663. <xsl:otherwise>
  664. <xsl:call-template name="inline.italicseq"/>
  665. </xsl:otherwise>
  666. </xsl:choose>
  667. </xsl:when>
  668. <xsl:when test="not(@linkend)
  669. and ($firstterm.only.link = 0 or $firstterm = 1)
  670. and ($glossterm.auto.link != 0)
  671. and $glossary.collection != ''">
  672. <xsl:variable name="term">
  673. <xsl:choose>
  674. <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
  675. <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  676. </xsl:choose>
  677. </xsl:variable>
  678. <xsl:variable name="cterm"
  679. select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
  680. <xsl:choose>
  681. <xsl:when test="not($cterm)">
  682. <xsl:message>
  683. <xsl:text>There's no entry for </xsl:text>
  684. <xsl:value-of select="$term"/>
  685. <xsl:text> in </xsl:text>
  686. <xsl:value-of select="$glossary.collection"/>
  687. </xsl:message>
  688. <xsl:call-template name="inline.italicseq"/>
  689. </xsl:when>
  690. <xsl:otherwise>
  691. <xsl:variable name="id">
  692. <xsl:call-template name="object.id">
  693. <xsl:with-param name="object" select="$cterm"/>
  694. </xsl:call-template>
  695. </xsl:variable>
  696. <fo:basic-link internal-destination="{$id}"
  697. xsl:use-attribute-sets="xref.properties">
  698. <xsl:call-template name="inline.italicseq"/>
  699. </fo:basic-link>
  700. </xsl:otherwise>
  701. </xsl:choose>
  702. </xsl:when>
  703. <xsl:when test="not(@linkend)
  704. and ($firstterm.only.link = 0 or $firstterm = 1)
  705. and $glossterm.auto.link != 0">
  706. <xsl:variable name="term">
  707. <xsl:choose>
  708. <xsl:when test="@baseform">
  709. <xsl:value-of select="@baseform"/>
  710. </xsl:when>
  711. <xsl:otherwise>
  712. <xsl:value-of select="."/>
  713. </xsl:otherwise>
  714. </xsl:choose>
  715. </xsl:variable>
  716. <xsl:variable name="targets"
  717. select="//glossentry[glossterm=$term or glossterm/@baseform=$term]"/>
  718. <xsl:variable name="target" select="$targets[1]"/>
  719. <xsl:choose>
  720. <xsl:when test="count($targets)=0">
  721. <xsl:message>
  722. <xsl:text>Error: no glossentry for glossterm: </xsl:text>
  723. <xsl:value-of select="."/>
  724. <xsl:text>.</xsl:text>
  725. </xsl:message>
  726. <xsl:call-template name="inline.italicseq"/>
  727. </xsl:when>
  728. <xsl:otherwise>
  729. <xsl:variable name="termid">
  730. <xsl:call-template name="object.id">
  731. <xsl:with-param name="object" select="$target"/>
  732. </xsl:call-template>
  733. </xsl:variable>
  734. <fo:basic-link internal-destination="{$termid}"
  735. xsl:use-attribute-sets="xref.properties">
  736. <xsl:call-template name="inline.charseq"/>
  737. </fo:basic-link>
  738. </xsl:otherwise>
  739. </xsl:choose>
  740. </xsl:when>
  741. <xsl:otherwise>
  742. <xsl:call-template name="inline.italicseq"/>
  743. </xsl:otherwise>
  744. </xsl:choose>
  745. </xsl:template>
  746. <xsl:template match="termdef">
  747. <fo:inline>
  748. <xsl:call-template name="gentext.template">
  749. <xsl:with-param name="context" select="'termdef'"/>
  750. <xsl:with-param name="name" select="'prefix'"/>
  751. </xsl:call-template>
  752. <xsl:apply-templates/>
  753. <xsl:call-template name="gentext.template">
  754. <xsl:with-param name="context" select="'termdef'"/>
  755. <xsl:with-param name="name" select="'suffix'"/>
  756. </xsl:call-template>
  757. </fo:inline>
  758. </xsl:template>
  759. <xsl:template match="sgmltag|tag">
  760. <xsl:variable name="class">
  761. <xsl:choose>
  762. <xsl:when test="@class">
  763. <xsl:value-of select="@class"/>
  764. </xsl:when>
  765. <xsl:otherwise>element</xsl:otherwise>
  766. </xsl:choose>
  767. </xsl:variable>
  768. <xsl:choose>
  769. <xsl:when test="$class='attribute'">
  770. <xsl:call-template name="inline.monoseq"/>
  771. </xsl:when>
  772. <xsl:when test="$class='attvalue'">
  773. <xsl:call-template name="inline.monoseq"/>
  774. </xsl:when>
  775. <xsl:when test="$class='element'">
  776. <xsl:call-template name="inline.monoseq"/>
  777. </xsl:when>
  778. <xsl:when test="$class='endtag'">
  779. <xsl:call-template name="inline.monoseq">
  780. <xsl:with-param name="content">
  781. <xsl:text>&lt;/</xsl:text>
  782. <xsl:apply-templates/>
  783. <xsl:text>&gt;</xsl:text>
  784. </xsl:with-param>
  785. </xsl:call-template>
  786. </xsl:when>
  787. <xsl:when test="$class='genentity'">
  788. <xsl:call-template name="inline.monoseq">
  789. <xsl:with-param name="content">
  790. <xsl:text>&amp;</xsl:text>
  791. <xsl:apply-templates/>
  792. <xsl:text>;</xsl:text>
  793. </xsl:with-param>
  794. </xsl:call-template>
  795. </xsl:when>
  796. <xsl:when test="$class='numcharref'">
  797. <xsl:call-template name="inline.monoseq">
  798. <xsl:with-param name="content">
  799. <xsl:text>&amp;#</xsl:text>
  800. <xsl:apply-templates/>
  801. <xsl:text>;</xsl:text>
  802. </xsl:with-param>
  803. </xsl:call-template>
  804. </xsl:when>
  805. <xsl:when test="$class='paramentity'">
  806. <xsl:call-template name="inline.monoseq">
  807. <xsl:with-param name="content">
  808. <xsl:text>%</xsl:text>
  809. <xsl:apply-templates/>
  810. <xsl:text>;</xsl:text>
  811. </xsl:with-param>
  812. </xsl:call-template>
  813. </xsl:when>
  814. <xsl:when test="$class='pi'">
  815. <xsl:call-template name="inline.monoseq">
  816. <xsl:with-param name="content">
  817. <xsl:text>&lt;?</xsl:text>
  818. <xsl:apply-templates/>
  819. <xsl:text>&gt;</xsl:text>
  820. </xsl:with-param>
  821. </xsl:call-template>
  822. </xsl:when>
  823. <xsl:when test="$class='xmlpi'">
  824. <xsl:call-template name="inline.monoseq">
  825. <xsl:with-param name="content">
  826. <xsl:text>&lt;?</xsl:text>
  827. <xsl:apply-templates/>
  828. <xsl:text>?&gt;</xsl:text>
  829. </xsl:with-param>
  830. </xsl:call-template>
  831. </xsl:when>
  832. <xsl:when test="$class='starttag'">
  833. <xsl:call-template name="inline.monoseq">
  834. <xsl:with-param name="content">
  835. <xsl:text>&lt;</xsl:text>
  836. <xsl:apply-templates/>
  837. <xsl:text>&gt;</xsl:text>
  838. </xsl:with-param>
  839. </xsl:call-template>
  840. </xsl:when>
  841. <xsl:when test="$class='emptytag'">
  842. <xsl:call-template name="inline.monoseq">
  843. <xsl:with-param name="content">
  844. <xsl:text>&lt;</xsl:text>
  845. <xsl:apply-templates/>
  846. <xsl:text>/&gt;</xsl:text>
  847. </xsl:with-param>
  848. </xsl:call-template>
  849. </xsl:when>
  850. <xsl:when test="$class='sgmlcomment' or $class='comment'">
  851. <xsl:call-template name="inline.monoseq">
  852. <xsl:with-param name="content">
  853. <xsl:text>&lt;!--</xsl:text>
  854. <xsl:apply-templates/>
  855. <xsl:text>--&gt;</xsl:text>
  856. </xsl:with-param>
  857. </xsl:call-template>
  858. </xsl:when>
  859. <xsl:otherwise>
  860. <xsl:call-template name="inline.charseq"/>
  861. </xsl:otherwise>
  862. </xsl:choose>
  863. </xsl:template>
  864. <xsl:template match="email">
  865. <xsl:call-template name="inline.monoseq">
  866. <xsl:with-param name="content">
  867. <fo:inline keep-together.within-line="always" hyphenate="false">
  868. <xsl:if test="not($email.delimiters.enabled = 0)">
  869. <xsl:text>&lt;</xsl:text>
  870. </xsl:if>
  871. <xsl:apply-templates/>
  872. <xsl:if test="not($email.delimiters.enabled = 0)">
  873. <xsl:text>&gt;</xsl:text>
  874. </xsl:if>
  875. </fo:inline>
  876. </xsl:with-param>
  877. </xsl:call-template>
  878. </xsl:template>
  879. <xsl:template match="keycombo">
  880. <xsl:variable name="action" select="@action"/>
  881. <xsl:variable name="joinchar">
  882. <xsl:choose>
  883. <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
  884. <xsl:when test="$action='simul'">+</xsl:when>
  885. <xsl:when test="$action='press'">-</xsl:when>
  886. <xsl:when test="$action='click'">-</xsl:when>
  887. <xsl:when test="$action='double-click'">-</xsl:when>
  888. <xsl:when test="$action='other'"></xsl:when>
  889. <xsl:otherwise>+</xsl:otherwise>
  890. </xsl:choose>
  891. </xsl:variable>
  892. <xsl:for-each select="*">
  893. <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
  894. <xsl:apply-templates select="."/>
  895. </xsl:for-each>
  896. </xsl:template>
  897. <xsl:template match="uri">
  898. <xsl:call-template name="inline.monoseq"/>
  899. </xsl:template>
  900. <!-- ==================================================================== -->
  901. <xsl:template match="menuchoice">
  902. <xsl:variable name="shortcut" select="./shortcut"/>
  903. <xsl:call-template name="process.menuchoice"/>
  904. <xsl:if test="$shortcut">
  905. <xsl:text> (</xsl:text>
  906. <xsl:apply-templates select="$shortcut"/>
  907. <xsl:text>)</xsl:text>
  908. </xsl:if>
  909. </xsl:template>
  910. <xsl:template name="process.menuchoice">
  911. <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
  912. <xsl:param name="count" select="1"/>
  913. <xsl:variable name="mm.separator">
  914. <xsl:choose>
  915. <xsl:when test="($fop.extensions != 0 or $fop1.extensions != 0 ) and
  916. contains($menuchoice.menu.separator, '&#x2192;')">
  917. <fo:inline font-family="Symbol">
  918. <xsl:copy-of select="$menuchoice.menu.separator"/>
  919. </fo:inline>
  920. </xsl:when>
  921. <xsl:otherwise>
  922. <xsl:copy-of select="$menuchoice.menu.separator"/>
  923. </xsl:otherwise>
  924. </xsl:choose>
  925. </xsl:variable>
  926. <xsl:choose>
  927. <xsl:when test="$count>count($nodelist)"></xsl:when>
  928. <xsl:when test="$count=1">
  929. <xsl:apply-templates select="$nodelist[$count=position()]"/>
  930. <xsl:call-template name="process.menuchoice">
  931. <xsl:with-param name="nodelist" select="$nodelist"/>
  932. <xsl:with-param name="count" select="$count+1"/>
  933. </xsl:call-template>
  934. </xsl:when>
  935. <xsl:otherwise>
  936. <xsl:variable name="node" select="$nodelist[$count=position()]"/>
  937. <xsl:choose>
  938. <xsl:when test="local-name($node)='guimenuitem'
  939. or local-name($node)='guisubmenu'">
  940. <xsl:copy-of select="$mm.separator"/>
  941. </xsl:when>
  942. <xsl:otherwise>
  943. <xsl:copy-of select="$menuchoice.separator"/>
  944. </xsl:otherwise>
  945. </xsl:choose>
  946. <xsl:apply-templates select="$node"/>
  947. <xsl:call-template name="process.menuchoice">
  948. <xsl:with-param name="nodelist" select="$nodelist"/>
  949. <xsl:with-param name="count" select="$count+1"/>
  950. </xsl:call-template>
  951. </xsl:otherwise>
  952. </xsl:choose>
  953. </xsl:template>
  954. <!-- ==================================================================== -->
  955. <xsl:template match="optional">
  956. <xsl:value-of select="$arg.choice.opt.open.str"/>
  957. <xsl:call-template name="inline.charseq"/>
  958. <xsl:value-of select="$arg.choice.opt.close.str"/>
  959. </xsl:template>
  960. <xsl:template match="citation">
  961. <!-- todo: integrate with bibliography collection -->
  962. <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
  963. <xsl:variable name="target" select="$targets[1]"/>
  964. <xsl:choose>
  965. <!-- try automatic linking based on match to abbrev -->
  966. <xsl:when test="$target and not(xref) and not(link)">
  967. <xsl:text>[</xsl:text>
  968. <fo:basic-link>
  969. <xsl:attribute name="internal-destination">
  970. <xsl:call-template name="object.id">
  971. <xsl:with-param name="object" select="$target"/>
  972. </xsl:call-template>
  973. </xsl:attribute>
  974. <xsl:choose>
  975. <xsl:when test="$bibliography.numbered != 0">
  976. <xsl:apply-templates select="$target" mode="citation"/>
  977. </xsl:when>
  978. <xsl:otherwise>
  979. <xsl:call-template name="inline.charseq"/>
  980. </xsl:otherwise>
  981. </xsl:choose>
  982. </fo:basic-link>
  983. <xsl:text>]</xsl:text>
  984. </xsl:when>
  985. <xsl:otherwise>
  986. <xsl:text>[</xsl:text>
  987. <xsl:call-template name="inline.charseq"/>
  988. <xsl:text>]</xsl:text>
  989. </xsl:otherwise>
  990. </xsl:choose>
  991. </xsl:template>
  992. <xsl:template match="biblioentry|bibliomixed" mode="citation">
  993. <xsl:number from="bibliography" count="biblioentry|bibliomixed"
  994. level="any" format="1"/>
  995. </xsl:template>
  996. <!-- ==================================================================== -->
  997. <xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
  998. <xsl:if test="$show.comments != 0">
  999. <fo:block font-style="italic">
  1000. <xsl:call-template name="inline.charseq"/>
  1001. </fo:block>
  1002. </xsl:if>
  1003. </xsl:template>
  1004. <xsl:template match="comment|remark">
  1005. <xsl:if test="$show.comments != 0">
  1006. <fo:inline font-style="italic">
  1007. <xsl:call-template name="inline.charseq"/>
  1008. </fo:inline>
  1009. </xsl:if>
  1010. </xsl:template>
  1011. <!-- ==================================================================== -->
  1012. <xsl:template match="productname">
  1013. <xsl:call-template name="inline.charseq"/>
  1014. <xsl:if test="@class">
  1015. <xsl:call-template name="dingbat">
  1016. <xsl:with-param name="dingbat" select="@class"/>
  1017. </xsl:call-template>
  1018. </xsl:if>
  1019. </xsl:template>
  1020. <xsl:template match="productnumber">
  1021. <xsl:call-template name="inline.charseq"/>
  1022. </xsl:template>
  1023. <!-- ==================================================================== -->
  1024. <xsl:template match="pob|street|city|state|postcode|country|otheraddr">
  1025. <xsl:call-template name="inline.charseq"/>
  1026. </xsl:template>
  1027. <xsl:template match="phone|fax">
  1028. <xsl:call-template name="inline.charseq"/>
  1029. </xsl:template>
  1030. <!-- in Addresses, for example -->
  1031. <xsl:template match="honorific|firstname|surname|lineage|othername">
  1032. <xsl:call-template name="inline.charseq"/>
  1033. </xsl:template>
  1034. <!-- ==================================================================== -->
  1035. <xsl:template match="person">
  1036. <xsl:apply-templates select="personname"/>
  1037. </xsl:template>
  1038. <xsl:template match="personname">
  1039. <xsl:call-template name="simple.xlink">
  1040. <xsl:with-param name="content">
  1041. <xsl:call-template name="person.name"/>
  1042. </xsl:with-param>
  1043. </xsl:call-template>
  1044. </xsl:template>
  1045. <xsl:template match="jobtitle">
  1046. <xsl:call-template name="simple.xlink">
  1047. <xsl:with-param name="content">
  1048. <xsl:apply-templates/>
  1049. </xsl:with-param>
  1050. </xsl:call-template>
  1051. </xsl:template>
  1052. <!-- ==================================================================== -->
  1053. <xsl:template match="org">
  1054. <xsl:call-template name="inline.charseq"/>
  1055. </xsl:template>
  1056. <xsl:template match="orgname">
  1057. <xsl:call-template name="inline.charseq"/>
  1058. </xsl:template>
  1059. <xsl:template match="orgdiv">
  1060. <xsl:call-template name="inline.charseq"/>
  1061. </xsl:template>
  1062. <xsl:template match="affiliation">
  1063. <xsl:call-template name="inline.charseq"/>
  1064. </xsl:template>
  1065. <!-- ==================================================================== -->
  1066. <xsl:template match="beginpage">
  1067. <!-- does nothing; this *is not* markup to force a page break. -->
  1068. </xsl:template>
  1069. </xsl:stylesheet>