inline.xsl 36 KB

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