inline.xsl 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  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://nwalsh.com/docbook/xsl/ for copyright
  25. 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:call-template name="inline.charseq"/>
  975. </fo:basic-link>
  976. <xsl:text>]</xsl:text>
  977. </xsl:when>
  978. <xsl:otherwise>
  979. <xsl:text>[</xsl:text>
  980. <xsl:call-template name="inline.charseq"/>
  981. <xsl:text>]</xsl:text>
  982. </xsl:otherwise>
  983. </xsl:choose>
  984. </xsl:template>
  985. <!-- ==================================================================== -->
  986. <xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
  987. <xsl:if test="$show.comments != 0">
  988. <fo:block font-style="italic">
  989. <xsl:call-template name="inline.charseq"/>
  990. </fo:block>
  991. </xsl:if>
  992. </xsl:template>
  993. <xsl:template match="comment|remark">
  994. <xsl:if test="$show.comments != 0">
  995. <fo:inline font-style="italic">
  996. <xsl:call-template name="inline.charseq"/>
  997. </fo:inline>
  998. </xsl:if>
  999. </xsl:template>
  1000. <!-- ==================================================================== -->
  1001. <xsl:template match="productname">
  1002. <xsl:call-template name="inline.charseq"/>
  1003. <xsl:if test="@class">
  1004. <xsl:call-template name="dingbat">
  1005. <xsl:with-param name="dingbat" select="@class"/>
  1006. </xsl:call-template>
  1007. </xsl:if>
  1008. </xsl:template>
  1009. <xsl:template match="productnumber">
  1010. <xsl:call-template name="inline.charseq"/>
  1011. </xsl:template>
  1012. <!-- ==================================================================== -->
  1013. <xsl:template match="pob|street|city|state|postcode|country|otheraddr">
  1014. <xsl:call-template name="inline.charseq"/>
  1015. </xsl:template>
  1016. <xsl:template match="phone|fax">
  1017. <xsl:call-template name="inline.charseq"/>
  1018. </xsl:template>
  1019. <!-- in Addresses, for example -->
  1020. <xsl:template match="honorific|firstname|surname|lineage|othername">
  1021. <xsl:call-template name="inline.charseq"/>
  1022. </xsl:template>
  1023. <!-- ==================================================================== -->
  1024. <xsl:template match="personname">
  1025. <xsl:call-template name="simple.xlink">
  1026. <xsl:with-param name="content">
  1027. <xsl:call-template name="person.name"/>
  1028. </xsl:with-param>
  1029. </xsl:call-template>
  1030. </xsl:template>
  1031. <xsl:template match="jobtitle">
  1032. <xsl:call-template name="simple.xlink">
  1033. <xsl:with-param name="content">
  1034. <xsl:apply-templates/>
  1035. </xsl:with-param>
  1036. </xsl:call-template>
  1037. </xsl:template>
  1038. <!-- ==================================================================== -->
  1039. <xsl:template match="org">
  1040. <xsl:call-template name="inline.charseq"/>
  1041. </xsl:template>
  1042. <xsl:template match="orgname">
  1043. <xsl:call-template name="inline.charseq"/>
  1044. </xsl:template>
  1045. <xsl:template match="orgdiv">
  1046. <xsl:call-template name="inline.charseq"/>
  1047. </xsl:template>
  1048. <xsl:template match="affiliation">
  1049. <xsl:call-template name="inline.charseq"/>
  1050. </xsl:template>
  1051. <!-- ==================================================================== -->
  1052. <xsl:template match="beginpage">
  1053. <!-- does nothing; this *is not* markup to force a page break. -->
  1054. </xsl:template>
  1055. </xsl:stylesheet>