inline.xsl 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532
  1. <?xml version='1.0'?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY % common.entities SYSTEM "../common/entities.ent">
  4. %common.entities;
  5. ]>
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns:xlink='http://www.w3.org/1999/xlink'
  8. xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
  9. exclude-result-prefixes="xlink suwl"
  10. version='1.0'>
  11. <!-- ********************************************************************
  12. $Id: inline.xsl 9663 2012-11-06 19:09:16Z bobstayton $
  13. ********************************************************************
  14. This file is part of the XSL DocBook Stylesheet distribution.
  15. See ../README or http://docbook.sf.net/release/xsl/current/ for
  16. copyright and other information.
  17. ******************************************************************** -->
  18. <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm)"/>
  19. <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm/@baseform)"/>
  20. <xsl:template name="simple.xlink">
  21. <xsl:param name="node" select="."/>
  22. <xsl:param name="content">
  23. <xsl:apply-templates/>
  24. </xsl:param>
  25. <xsl:param name="linkend" select="$node/@linkend"/>
  26. <xsl:param name="xhref" select="$node/@xlink:href"/>
  27. <!-- Support for @xlink:show -->
  28. <xsl:variable name="target.show">
  29. <xsl:choose>
  30. <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when>
  31. <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when>
  32. <xsl:otherwise></xsl:otherwise>
  33. </xsl:choose>
  34. </xsl:variable>
  35. <xsl:variable name="link">
  36. <xsl:choose>
  37. <xsl:when test="$xhref and
  38. (not($node/@xlink:type) or
  39. $node/@xlink:type='simple')">
  40. <!-- Is it a local idref or a uri? -->
  41. <xsl:variable name="is.idref">
  42. <xsl:choose>
  43. <!-- if the href starts with # and does not contain an "(" -->
  44. <!-- or if the href starts with #xpointer(id(, it's just an ID -->
  45. <xsl:when test="starts-with($xhref,'#')
  46. and (not(contains($xhref,'&#40;'))
  47. or starts-with($xhref,
  48. '#xpointer&#40;id&#40;'))">1</xsl:when>
  49. <xsl:otherwise>0</xsl:otherwise>
  50. </xsl:choose>
  51. </xsl:variable>
  52. <!-- Is it an olink ? -->
  53. <xsl:variable name="is.olink">
  54. <xsl:choose>
  55. <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
  56. <!-- and if the href contains # -->
  57. <xsl:when test="contains($xhref,'#') and
  58. @xlink:role = $xolink.role">1</xsl:when>
  59. <xsl:otherwise>0</xsl:otherwise>
  60. </xsl:choose>
  61. </xsl:variable>
  62. <xsl:choose>
  63. <xsl:when test="$is.olink = 1">
  64. <xsl:call-template name="olink">
  65. <xsl:with-param name="content" select="$content"/>
  66. </xsl:call-template>
  67. </xsl:when>
  68. <xsl:when test="$is.idref = 1">
  69. <xsl:variable name="idref">
  70. <xsl:call-template name="xpointer.idref">
  71. <xsl:with-param name="xpointer" select="$xhref"/>
  72. </xsl:call-template>
  73. </xsl:variable>
  74. <xsl:variable name="targets" select="key('id',$idref)"/>
  75. <xsl:variable name="target" select="$targets[1]"/>
  76. <xsl:call-template name="check.id.unique">
  77. <xsl:with-param name="linkend" select="$idref"/>
  78. </xsl:call-template>
  79. <xsl:choose>
  80. <xsl:when test="count($target) = 0">
  81. <xsl:message>
  82. <xsl:text>XLink to nonexistent id: </xsl:text>
  83. <xsl:value-of select="$idref"/>
  84. </xsl:message>
  85. <xsl:copy-of select="$content"/>
  86. </xsl:when>
  87. <xsl:otherwise>
  88. <a>
  89. <xsl:apply-templates select="." mode="common.html.attributes"/>
  90. <xsl:call-template name="id.attribute"/>
  91. <xsl:attribute name="href">
  92. <xsl:call-template name="href.target">
  93. <xsl:with-param name="object" select="$target"/>
  94. </xsl:call-template>
  95. </xsl:attribute>
  96. <xsl:choose>
  97. <xsl:when test="$node/@xlink:title">
  98. <xsl:attribute name="title">
  99. <xsl:value-of select="$node/@xlink:title"/>
  100. </xsl:attribute>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:apply-templates select="$target"
  104. mode="html.title.attribute"/>
  105. </xsl:otherwise>
  106. </xsl:choose>
  107. <xsl:if test="$target.show !=''">
  108. <xsl:attribute name="target">
  109. <xsl:value-of select="$target.show"/>
  110. </xsl:attribute>
  111. </xsl:if>
  112. <xsl:copy-of select="$content"/>
  113. </a>
  114. </xsl:otherwise>
  115. </xsl:choose>
  116. </xsl:when>
  117. <!-- otherwise it's a URI -->
  118. <xsl:otherwise>
  119. <a>
  120. <xsl:apply-templates select="." mode="common.html.attributes"/>
  121. <xsl:call-template name="id.attribute"/>
  122. <xsl:attribute name="href">
  123. <xsl:value-of select="$xhref"/>
  124. </xsl:attribute>
  125. <xsl:if test="$node/@xlink:title">
  126. <xsl:attribute name="title">
  127. <xsl:value-of select="$node/@xlink:title"/>
  128. </xsl:attribute>
  129. </xsl:if>
  130. <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
  131. <xsl:choose>
  132. <xsl:when test="$target.show !=''">
  133. <xsl:attribute name="target">
  134. <xsl:value-of select="$target.show"/>
  135. </xsl:attribute>
  136. </xsl:when>
  137. <xsl:when test="$ulink.target !=''">
  138. <xsl:attribute name="target">
  139. <xsl:value-of select="$ulink.target"/>
  140. </xsl:attribute>
  141. </xsl:when>
  142. </xsl:choose>
  143. <xsl:copy-of select="$content"/>
  144. </a>
  145. </xsl:otherwise>
  146. </xsl:choose>
  147. </xsl:when>
  148. <xsl:when test="$linkend">
  149. <xsl:variable name="targets" select="key('id',$linkend)"/>
  150. <xsl:variable name="target" select="$targets[1]"/>
  151. <xsl:call-template name="check.id.unique">
  152. <xsl:with-param name="linkend" select="$linkend"/>
  153. </xsl:call-template>
  154. <a>
  155. <xsl:apply-templates select="." mode="common.html.attributes"/>
  156. <xsl:call-template name="id.attribute"/>
  157. <xsl:attribute name="href">
  158. <xsl:call-template name="href.target">
  159. <xsl:with-param name="object" select="$target"/>
  160. </xsl:call-template>
  161. </xsl:attribute>
  162. <xsl:apply-templates select="$target" mode="html.title.attribute"/>
  163. <xsl:copy-of select="$content"/>
  164. </a>
  165. </xsl:when>
  166. <xsl:otherwise>
  167. <xsl:copy-of select="$content"/>
  168. </xsl:otherwise>
  169. </xsl:choose>
  170. </xsl:variable>
  171. <xsl:choose>
  172. <xsl:when test="function-available('suwl:unwrapLinks')">
  173. <xsl:copy-of select="suwl:unwrapLinks($link)"/>
  174. </xsl:when>
  175. <xsl:otherwise>
  176. <xsl:copy-of select="$link"/>
  177. </xsl:otherwise>
  178. </xsl:choose>
  179. </xsl:template>
  180. <xsl:template name="inline.charseq">
  181. <xsl:param name="content">
  182. <xsl:call-template name="anchor"/>
  183. <xsl:call-template name="simple.xlink">
  184. <xsl:with-param name="content">
  185. <xsl:apply-templates/>
  186. </xsl:with-param>
  187. </xsl:call-template>
  188. </xsl:param>
  189. <!-- * if you want output from the inline.charseq template wrapped in -->
  190. <!-- * something other than a Span, call the template with some value -->
  191. <!-- * for the 'wrapper-name' param -->
  192. <xsl:param name="wrapper-name">span</xsl:param>
  193. <xsl:element name="{$wrapper-name}">
  194. <xsl:attribute name="class">
  195. <xsl:value-of select="local-name(.)"/>
  196. </xsl:attribute>
  197. <xsl:call-template name="id.attribute"/>
  198. <xsl:call-template name="dir"/>
  199. <xsl:call-template name="generate.html.title"/>
  200. <xsl:copy-of select="$content"/>
  201. <xsl:call-template name="apply-annotations"/>
  202. </xsl:element>
  203. </xsl:template>
  204. <xsl:template name="inline.monoseq">
  205. <xsl:param name="content">
  206. <xsl:call-template name="anchor"/>
  207. <xsl:call-template name="simple.xlink">
  208. <xsl:with-param name="content">
  209. <xsl:apply-templates/>
  210. </xsl:with-param>
  211. </xsl:call-template>
  212. </xsl:param>
  213. <code>
  214. <xsl:apply-templates select="." mode="common.html.attributes"/>
  215. <xsl:call-template name="id.attribute"/>
  216. <xsl:copy-of select="$content"/>
  217. <xsl:call-template name="apply-annotations"/>
  218. </code>
  219. </xsl:template>
  220. <xsl:template name="inline.boldseq">
  221. <xsl:param name="content">
  222. <xsl:call-template name="anchor"/>
  223. <xsl:call-template name="simple.xlink">
  224. <xsl:with-param name="content">
  225. <xsl:apply-templates/>
  226. </xsl:with-param>
  227. </xsl:call-template>
  228. </xsl:param>
  229. <span>
  230. <xsl:apply-templates select="." mode="common.html.attributes"/>
  231. <xsl:call-template name="id.attribute"/>
  232. <!-- don't put <strong> inside figure, example, or table titles -->
  233. <xsl:choose>
  234. <xsl:when test="local-name(..) = 'title'
  235. and (local-name(../..) = 'figure'
  236. or local-name(../..) = 'example'
  237. or local-name(../..) = 'table')">
  238. <xsl:copy-of select="$content"/>
  239. </xsl:when>
  240. <xsl:otherwise>
  241. <strong>
  242. <xsl:copy-of select="$content"/>
  243. </strong>
  244. </xsl:otherwise>
  245. </xsl:choose>
  246. <xsl:call-template name="apply-annotations"/>
  247. </span>
  248. </xsl:template>
  249. <xsl:template name="inline.italicseq">
  250. <xsl:param name="content">
  251. <xsl:call-template name="anchor"/>
  252. <xsl:call-template name="simple.xlink">
  253. <xsl:with-param name="content">
  254. <xsl:apply-templates/>
  255. </xsl:with-param>
  256. </xsl:call-template>
  257. </xsl:param>
  258. <em>
  259. <xsl:call-template name="common.html.attributes"/>
  260. <xsl:call-template name="id.attribute"/>
  261. <xsl:copy-of select="$content"/>
  262. <xsl:call-template name="apply-annotations"/>
  263. </em>
  264. </xsl:template>
  265. <xsl:template name="inline.boldmonoseq">
  266. <xsl:param name="content">
  267. <xsl:call-template name="anchor"/>
  268. <xsl:call-template name="simple.xlink">
  269. <xsl:with-param name="content">
  270. <xsl:apply-templates/>
  271. </xsl:with-param>
  272. </xsl:call-template>
  273. </xsl:param>
  274. <!-- don't put <strong> inside figure, example, or table titles -->
  275. <!-- or other titles that may already be represented with <strong>'s. -->
  276. <xsl:choose>
  277. <xsl:when test="local-name(..) = 'title'
  278. and (local-name(../..) = 'figure'
  279. or local-name(../..) = 'example'
  280. or local-name(../..) = 'table'
  281. or local-name(../..) = 'formalpara')">
  282. <code>
  283. <xsl:call-template name="common.html.attributes"/>
  284. <xsl:call-template name="id.attribute"/>
  285. <xsl:copy-of select="$content"/>
  286. <xsl:call-template name="apply-annotations"/>
  287. </code>
  288. </xsl:when>
  289. <xsl:otherwise>
  290. <strong>
  291. <xsl:call-template name="common.html.attributes"/>
  292. <xsl:call-template name="id.attribute"/>
  293. <code>
  294. <xsl:call-template name="generate.html.title"/>
  295. <xsl:call-template name="dir"/>
  296. <xsl:copy-of select="$content"/>
  297. </code>
  298. <xsl:call-template name="apply-annotations"/>
  299. </strong>
  300. </xsl:otherwise>
  301. </xsl:choose>
  302. </xsl:template>
  303. <xsl:template name="inline.italicmonoseq">
  304. <xsl:param name="content">
  305. <xsl:call-template name="anchor"/>
  306. <xsl:call-template name="simple.xlink">
  307. <xsl:with-param name="content">
  308. <xsl:apply-templates/>
  309. </xsl:with-param>
  310. </xsl:call-template>
  311. </xsl:param>
  312. <em>
  313. <xsl:call-template name="common.html.attributes"/>
  314. <xsl:call-template name="id.attribute"/>
  315. <code>
  316. <xsl:call-template name="generate.html.title"/>
  317. <xsl:call-template name="dir"/>
  318. <xsl:copy-of select="$content"/>
  319. <xsl:call-template name="apply-annotations"/>
  320. </code>
  321. </em>
  322. </xsl:template>
  323. <xsl:template name="inline.superscriptseq">
  324. <xsl:param name="content">
  325. <xsl:call-template name="anchor"/>
  326. <xsl:call-template name="simple.xlink">
  327. <xsl:with-param name="content">
  328. <xsl:apply-templates/>
  329. </xsl:with-param>
  330. </xsl:call-template>
  331. </xsl:param>
  332. <sup>
  333. <xsl:call-template name="generate.html.title"/>
  334. <xsl:call-template name="id.attribute"/>
  335. <xsl:call-template name="dir"/>
  336. <xsl:copy-of select="$content"/>
  337. <xsl:call-template name="apply-annotations"/>
  338. </sup>
  339. </xsl:template>
  340. <xsl:template name="inline.subscriptseq">
  341. <xsl:param name="content">
  342. <xsl:call-template name="anchor"/>
  343. <xsl:call-template name="simple.xlink">
  344. <xsl:with-param name="content">
  345. <xsl:apply-templates/>
  346. </xsl:with-param>
  347. </xsl:call-template>
  348. </xsl:param>
  349. <sub>
  350. <xsl:call-template name="generate.html.title"/>
  351. <xsl:call-template name="id.attribute"/>
  352. <xsl:call-template name="dir"/>
  353. <xsl:copy-of select="$content"/>
  354. <xsl:call-template name="apply-annotations"/>
  355. </sub>
  356. </xsl:template>
  357. <!-- ==================================================================== -->
  358. <!-- some special cases -->
  359. <xsl:template match="author">
  360. <xsl:param name="content">
  361. <xsl:call-template name="anchor"/>
  362. <xsl:call-template name="simple.xlink">
  363. <xsl:with-param name="content">
  364. <xsl:call-template name="person.name"/>
  365. </xsl:with-param>
  366. </xsl:call-template>
  367. <xsl:call-template name="apply-annotations"/>
  368. </xsl:param>
  369. <span>
  370. <xsl:call-template name="common.html.attributes"/>
  371. <xsl:call-template name="id.attribute"/>
  372. <xsl:copy-of select="$content"/>
  373. </span>
  374. </xsl:template>
  375. <xsl:template match="editor">
  376. <xsl:param name="content">
  377. <xsl:call-template name="anchor"/>
  378. <xsl:call-template name="simple.xlink">
  379. <xsl:with-param name="content">
  380. <xsl:call-template name="person.name"/>
  381. </xsl:with-param>
  382. </xsl:call-template>
  383. <xsl:call-template name="apply-annotations"/>
  384. </xsl:param>
  385. <span>
  386. <xsl:call-template name="common.html.attributes"/>
  387. <xsl:call-template name="id.attribute"/>
  388. <xsl:copy-of select="$content"/>
  389. </span>
  390. </xsl:template>
  391. <xsl:template match="othercredit">
  392. <xsl:param name="content">
  393. <xsl:call-template name="anchor"/>
  394. <xsl:call-template name="simple.xlink">
  395. <xsl:with-param name="content">
  396. <xsl:call-template name="person.name"/>
  397. </xsl:with-param>
  398. </xsl:call-template>
  399. <xsl:call-template name="apply-annotations"/>
  400. </xsl:param>
  401. <span>
  402. <xsl:call-template name="common.html.attributes"/>
  403. <xsl:call-template name="id.attribute"/>
  404. <xsl:copy-of select="$content"/>
  405. </span>
  406. </xsl:template>
  407. <xsl:template match="authorinitials">
  408. <xsl:call-template name="inline.charseq"/>
  409. </xsl:template>
  410. <!-- ==================================================================== -->
  411. <xsl:template match="accel">
  412. <xsl:call-template name="inline.charseq"/>
  413. </xsl:template>
  414. <xsl:template match="action">
  415. <xsl:call-template name="inline.charseq"/>
  416. </xsl:template>
  417. <xsl:template match="application">
  418. <xsl:call-template name="inline.charseq"/>
  419. </xsl:template>
  420. <xsl:template match="classname">
  421. <xsl:call-template name="inline.monoseq"/>
  422. </xsl:template>
  423. <xsl:template match="exceptionname">
  424. <xsl:call-template name="inline.monoseq"/>
  425. </xsl:template>
  426. <xsl:template match="interfacename">
  427. <xsl:call-template name="inline.monoseq"/>
  428. </xsl:template>
  429. <xsl:template match="methodname">
  430. <xsl:call-template name="inline.monoseq"/>
  431. </xsl:template>
  432. <xsl:template match="command">
  433. <xsl:call-template name="inline.boldseq"/>
  434. </xsl:template>
  435. <xsl:template match="computeroutput">
  436. <xsl:call-template name="inline.monoseq"/>
  437. </xsl:template>
  438. <xsl:template match="constant">
  439. <xsl:call-template name="inline.monoseq"/>
  440. </xsl:template>
  441. <xsl:template match="database">
  442. <xsl:call-template name="inline.charseq"/>
  443. </xsl:template>
  444. <xsl:template match="date">
  445. <!-- should this support locale-specific formatting? how? -->
  446. <xsl:call-template name="inline.charseq"/>
  447. </xsl:template>
  448. <xsl:template match="errorcode">
  449. <xsl:call-template name="inline.charseq"/>
  450. </xsl:template>
  451. <xsl:template match="errorname">
  452. <xsl:call-template name="inline.charseq"/>
  453. </xsl:template>
  454. <xsl:template match="errortype">
  455. <xsl:call-template name="inline.charseq"/>
  456. </xsl:template>
  457. <xsl:template match="errortext">
  458. <xsl:call-template name="inline.charseq"/>
  459. </xsl:template>
  460. <xsl:template match="envar">
  461. <xsl:call-template name="inline.monoseq"/>
  462. </xsl:template>
  463. <xsl:template match="filename">
  464. <xsl:call-template name="inline.monoseq"/>
  465. </xsl:template>
  466. <xsl:template match="function">
  467. <xsl:choose>
  468. <xsl:when test="$function.parens != '0'
  469. and (parameter or function or replaceable)">
  470. <xsl:variable name="nodes" select="text()|*"/>
  471. <xsl:call-template name="inline.monoseq">
  472. <xsl:with-param name="content">
  473. <xsl:call-template name="simple.xlink">
  474. <xsl:with-param name="content">
  475. <xsl:apply-templates select="$nodes[1]"/>
  476. </xsl:with-param>
  477. </xsl:call-template>
  478. </xsl:with-param>
  479. </xsl:call-template>
  480. <xsl:text>(</xsl:text>
  481. <xsl:apply-templates select="$nodes[position()>1]"/>
  482. <xsl:text>)</xsl:text>
  483. </xsl:when>
  484. <xsl:otherwise>
  485. <xsl:call-template name="inline.monoseq"/>
  486. </xsl:otherwise>
  487. </xsl:choose>
  488. </xsl:template>
  489. <xsl:template match="function/parameter" priority="2">
  490. <xsl:call-template name="inline.italicmonoseq"/>
  491. <xsl:if test="$function.parens != 0 and following-sibling::*">
  492. <xsl:text>, </xsl:text>
  493. </xsl:if>
  494. </xsl:template>
  495. <xsl:template match="function/replaceable" priority="2">
  496. <xsl:call-template name="inline.italicmonoseq"/>
  497. <xsl:if test="$function.parens != 0 and following-sibling::*">
  498. <xsl:text>, </xsl:text>
  499. </xsl:if>
  500. </xsl:template>
  501. <xsl:template match="guibutton">
  502. <xsl:call-template name="inline.charseq"/>
  503. </xsl:template>
  504. <xsl:template match="guiicon">
  505. <xsl:call-template name="inline.charseq"/>
  506. </xsl:template>
  507. <xsl:template match="guilabel">
  508. <xsl:call-template name="inline.charseq"/>
  509. </xsl:template>
  510. <xsl:template match="guimenu">
  511. <xsl:call-template name="inline.charseq"/>
  512. </xsl:template>
  513. <xsl:template match="guimenuitem">
  514. <xsl:call-template name="inline.charseq"/>
  515. </xsl:template>
  516. <xsl:template match="guisubmenu">
  517. <xsl:call-template name="inline.charseq"/>
  518. </xsl:template>
  519. <xsl:template match="hardware">
  520. <xsl:call-template name="inline.charseq"/>
  521. </xsl:template>
  522. <xsl:template match="interface">
  523. <xsl:call-template name="inline.charseq"/>
  524. </xsl:template>
  525. <xsl:template match="interfacedefinition">
  526. <xsl:call-template name="inline.charseq"/>
  527. </xsl:template>
  528. <xsl:template match="keycap">
  529. <xsl:choose>
  530. <xsl:when test="@function and normalize-space(.) = ''">
  531. <xsl:call-template name="inline.boldseq">
  532. <xsl:with-param name="content">
  533. <xsl:call-template name="gentext.template">
  534. <xsl:with-param name="context" select="'keycap'"/>
  535. <xsl:with-param name="name" select="@function"/>
  536. </xsl:call-template>
  537. </xsl:with-param>
  538. </xsl:call-template>
  539. </xsl:when>
  540. <xsl:otherwise>
  541. <xsl:call-template name="inline.boldseq"/>
  542. </xsl:otherwise>
  543. </xsl:choose>
  544. </xsl:template>
  545. <xsl:template match="keycode">
  546. <xsl:call-template name="inline.charseq"/>
  547. </xsl:template>
  548. <xsl:template match="keysym">
  549. <xsl:call-template name="inline.charseq"/>
  550. </xsl:template>
  551. <xsl:template match="literal">
  552. <xsl:call-template name="inline.monoseq"/>
  553. </xsl:template>
  554. <xsl:template match="code">
  555. <xsl:call-template name="inline.monoseq"/>
  556. </xsl:template>
  557. <xsl:template match="medialabel">
  558. <xsl:call-template name="inline.italicseq"/>
  559. </xsl:template>
  560. <xsl:template match="shortcut">
  561. <xsl:call-template name="inline.boldseq"/>
  562. </xsl:template>
  563. <xsl:template match="mousebutton">
  564. <xsl:call-template name="inline.charseq"/>
  565. </xsl:template>
  566. <xsl:template match="option">
  567. <xsl:call-template name="inline.monoseq"/>
  568. </xsl:template>
  569. <xsl:template match="package">
  570. <xsl:call-template name="inline.charseq"/>
  571. </xsl:template>
  572. <xsl:template match="parameter">
  573. <xsl:call-template name="inline.italicmonoseq"/>
  574. </xsl:template>
  575. <xsl:template match="property">
  576. <xsl:call-template name="inline.charseq"/>
  577. </xsl:template>
  578. <xsl:template match="prompt">
  579. <xsl:call-template name="inline.monoseq"/>
  580. </xsl:template>
  581. <xsl:template match="replaceable" priority="1">
  582. <xsl:call-template name="inline.italicmonoseq"/>
  583. </xsl:template>
  584. <xsl:template match="returnvalue">
  585. <xsl:call-template name="inline.charseq"/>
  586. </xsl:template>
  587. <xsl:template match="structfield">
  588. <xsl:call-template name="inline.italicmonoseq"/>
  589. </xsl:template>
  590. <xsl:template match="structname">
  591. <xsl:call-template name="inline.charseq"/>
  592. </xsl:template>
  593. <xsl:template match="symbol">
  594. <xsl:call-template name="inline.charseq"/>
  595. </xsl:template>
  596. <xsl:template match="systemitem">
  597. <xsl:call-template name="inline.monoseq"/>
  598. </xsl:template>
  599. <xsl:template match="token">
  600. <xsl:call-template name="inline.charseq"/>
  601. </xsl:template>
  602. <xsl:template match="type">
  603. <xsl:call-template name="inline.charseq"/>
  604. </xsl:template>
  605. <xsl:template match="userinput">
  606. <xsl:call-template name="inline.boldmonoseq"/>
  607. </xsl:template>
  608. <xsl:template match="abbrev">
  609. <xsl:call-template name="inline.charseq">
  610. <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
  611. </xsl:call-template>
  612. </xsl:template>
  613. <xsl:template match="acronym">
  614. <xsl:call-template name="inline.charseq">
  615. <xsl:with-param name="wrapper-name">acronym</xsl:with-param>
  616. </xsl:call-template>
  617. </xsl:template>
  618. <xsl:template match="citerefentry">
  619. <xsl:choose>
  620. <xsl:when test="$citerefentry.link != '0'">
  621. <a>
  622. <xsl:apply-templates select="." mode="common.html.attributes"/>
  623. <xsl:attribute name="href">
  624. <xsl:call-template name="generate.citerefentry.link"/>
  625. </xsl:attribute>
  626. <xsl:call-template name="inline.charseq"/>
  627. </a>
  628. </xsl:when>
  629. <xsl:otherwise>
  630. <xsl:call-template name="inline.charseq"/>
  631. </xsl:otherwise>
  632. </xsl:choose>
  633. </xsl:template>
  634. <xsl:template name="generate.citerefentry.link">
  635. <!-- nop -->
  636. </xsl:template>
  637. <xsl:template name="x.generate.citerefentry.link">
  638. <xsl:text>http://example.com/cgi-bin/man.cgi?</xsl:text>
  639. <xsl:value-of select="refentrytitle"/>
  640. <xsl:text>(</xsl:text>
  641. <xsl:value-of select="manvolnum"/>
  642. <xsl:text>)</xsl:text>
  643. </xsl:template>
  644. <xsl:template match="citetitle">
  645. <xsl:choose>
  646. <xsl:when test="@pubwork = 'article'">
  647. <xsl:call-template name="gentext.startquote"/>
  648. <xsl:call-template name="inline.charseq"/>
  649. <xsl:call-template name="gentext.endquote"/>
  650. </xsl:when>
  651. <xsl:otherwise>
  652. <xsl:call-template name="inline.italicseq"/>
  653. </xsl:otherwise>
  654. </xsl:choose>
  655. </xsl:template>
  656. <xsl:template match="emphasis">
  657. <span>
  658. <xsl:call-template name="id.attribute"/>
  659. <xsl:choose>
  660. <!-- We don't want empty @class values, so do not propagate empty @roles -->
  661. <xsl:when test="@role and
  662. normalize-space(@role) != '' and
  663. $emphasis.propagates.style != 0">
  664. <xsl:apply-templates select="." mode="common.html.attributes">
  665. <xsl:with-param name="class" select="@role"/>
  666. </xsl:apply-templates>
  667. </xsl:when>
  668. <xsl:otherwise>
  669. <xsl:apply-templates select="." mode="common.html.attributes"/>
  670. </xsl:otherwise>
  671. </xsl:choose>
  672. <xsl:call-template name="anchor"/>
  673. <xsl:call-template name="simple.xlink">
  674. <xsl:with-param name="content">
  675. <xsl:choose>
  676. <xsl:when test="@role = 'bold' or @role='strong'">
  677. <!-- backwards compatibility: make bold into b elements, but -->
  678. <!-- don't put bold inside figure, example, or table titles -->
  679. <xsl:choose>
  680. <xsl:when test="local-name(..) = 'title'
  681. and (local-name(../..) = 'figure'
  682. or local-name(../..) = 'example'
  683. or local-name(../..) = 'table')">
  684. <xsl:apply-templates/>
  685. </xsl:when>
  686. <xsl:otherwise>
  687. <strong><xsl:apply-templates/></strong>
  688. </xsl:otherwise>
  689. </xsl:choose>
  690. </xsl:when>
  691. <xsl:when test="@role and $emphasis.propagates.style != 0">
  692. <xsl:apply-templates/>
  693. </xsl:when>
  694. <xsl:otherwise>
  695. <em><xsl:apply-templates/></em>
  696. </xsl:otherwise>
  697. </xsl:choose>
  698. </xsl:with-param>
  699. </xsl:call-template>
  700. </span>
  701. </xsl:template>
  702. <xsl:template match="foreignphrase">
  703. <span>
  704. <xsl:apply-templates select="." mode="common.html.attributes"/>
  705. <xsl:call-template name="inline.italicseq"/>
  706. </span>
  707. </xsl:template>
  708. <xsl:template match="markup">
  709. <xsl:call-template name="inline.charseq"/>
  710. </xsl:template>
  711. <xsl:template match="phrase">
  712. <span>
  713. <xsl:call-template name="id.attribute"/>
  714. <xsl:call-template name="locale.html.attributes"/>
  715. <!-- We don't want empty @class values, so do not propagate empty @roles -->
  716. <xsl:choose>
  717. <xsl:when test="@role and
  718. normalize-space(@role) != '' and
  719. $phrase.propagates.style != 0">
  720. <xsl:apply-templates select="." mode="class.attribute">
  721. <xsl:with-param name="class" select="@role"/>
  722. </xsl:apply-templates>
  723. </xsl:when>
  724. <xsl:otherwise>
  725. <xsl:apply-templates select="." mode="class.attribute"/>
  726. </xsl:otherwise>
  727. </xsl:choose>
  728. <xsl:call-template name="dir"/>
  729. <xsl:call-template name="anchor"/>
  730. <xsl:call-template name="simple.xlink">
  731. <xsl:with-param name="content">
  732. <xsl:apply-templates/>
  733. </xsl:with-param>
  734. </xsl:call-template>
  735. <xsl:call-template name="apply-annotations"/>
  736. </span>
  737. </xsl:template>
  738. <xsl:template match="quote">
  739. <xsl:variable name="depth">
  740. <xsl:call-template name="dot.count">
  741. <xsl:with-param name="string">
  742. <xsl:number level="multiple"/>
  743. </xsl:with-param>
  744. </xsl:call-template>
  745. </xsl:variable>
  746. <span>
  747. <xsl:apply-templates select="." mode="common.html.attributes"/>
  748. <xsl:choose>
  749. <xsl:when test="$depth mod 2 = 0">
  750. <xsl:call-template name="gentext.startquote"/>
  751. <xsl:call-template name="inline.charseq"/>
  752. <xsl:call-template name="gentext.endquote"/>
  753. </xsl:when>
  754. <xsl:otherwise>
  755. <xsl:call-template name="gentext.nestedstartquote"/>
  756. <xsl:call-template name="inline.charseq"/>
  757. <xsl:call-template name="gentext.nestedendquote"/>
  758. </xsl:otherwise>
  759. </xsl:choose>
  760. </span>
  761. </xsl:template>
  762. <xsl:template match="varname">
  763. <xsl:call-template name="inline.monoseq"/>
  764. </xsl:template>
  765. <xsl:template match="wordasword">
  766. <xsl:call-template name="inline.italicseq"/>
  767. </xsl:template>
  768. <xsl:template match="lineannotation">
  769. <em>
  770. <xsl:apply-templates select="." mode="common.html.attributes"/>
  771. <xsl:call-template name="inline.charseq"/>
  772. </em>
  773. </xsl:template>
  774. <xsl:template match="superscript">
  775. <xsl:call-template name="inline.superscriptseq"/>
  776. </xsl:template>
  777. <xsl:template match="subscript">
  778. <xsl:call-template name="inline.subscriptseq"/>
  779. </xsl:template>
  780. <xsl:template match="trademark">
  781. <xsl:call-template name="inline.charseq"/>
  782. <xsl:choose>
  783. <xsl:when test="@class = 'copyright'
  784. or @class = 'registered'">
  785. <xsl:call-template name="dingbat">
  786. <xsl:with-param name="dingbat" select="@class"/>
  787. </xsl:call-template>
  788. </xsl:when>
  789. <xsl:when test="@class = 'service'">
  790. <sup>SM</sup>
  791. </xsl:when>
  792. <xsl:otherwise>
  793. <xsl:call-template name="dingbat">
  794. <xsl:with-param name="dingbat" select="'trademark'"/>
  795. </xsl:call-template>
  796. </xsl:otherwise>
  797. </xsl:choose>
  798. </xsl:template>
  799. <xsl:template match="firstterm">
  800. <xsl:call-template name="glossterm">
  801. <xsl:with-param name="firstterm" select="1"/>
  802. </xsl:call-template>
  803. </xsl:template>
  804. <xsl:template match="glossterm" name="glossterm">
  805. <xsl:param name="firstterm" select="0"/>
  806. <!-- To avoid extra <a name=""> anchor from inline.italicseq -->
  807. <xsl:variable name="content">
  808. <xsl:apply-templates/>
  809. </xsl:variable>
  810. <xsl:choose>
  811. <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
  812. <xsl:variable name="targets" select="key('id',@linkend)"/>
  813. <xsl:variable name="target" select="$targets[1]"/>
  814. <xsl:call-template name="check.id.unique">
  815. <xsl:with-param name="linkend" select="@linkend"/>
  816. </xsl:call-template>
  817. <xsl:choose>
  818. <xsl:when test="$target">
  819. <a>
  820. <xsl:apply-templates select="." mode="common.html.attributes"/>
  821. <xsl:if test="@id or @xml:id">
  822. <xsl:attribute name="name">
  823. <xsl:value-of select="(@id|@xml:id)[1]"/>
  824. </xsl:attribute>
  825. </xsl:if>
  826. <xsl:attribute name="href">
  827. <xsl:call-template name="href.target">
  828. <xsl:with-param name="object" select="$target"/>
  829. </xsl:call-template>
  830. </xsl:attribute>
  831. <xsl:call-template name="inline.italicseq">
  832. <xsl:with-param name="content" select="$content"/>
  833. </xsl:call-template>
  834. </a>
  835. </xsl:when>
  836. <xsl:otherwise>
  837. <xsl:call-template name="inline.italicseq">
  838. <xsl:with-param name="content" select="$content"/>
  839. </xsl:call-template>
  840. </xsl:otherwise>
  841. </xsl:choose>
  842. </xsl:when>
  843. <xsl:when test="not(@linkend)
  844. and ($firstterm.only.link = 0 or $firstterm = 1)
  845. and ($glossterm.auto.link != 0)
  846. and $glossary.collection != ''">
  847. <xsl:variable name="term">
  848. <xsl:choose>
  849. <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
  850. <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  851. </xsl:choose>
  852. </xsl:variable>
  853. <xsl:variable name="cterm"
  854. select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
  855. <!-- HACK HACK HACK! But it works... -->
  856. <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
  857. <xsl:variable name="glossary" select="//glossary[@role='auto']"/>
  858. <xsl:if test="count($glossary) != 1">
  859. <xsl:message>
  860. <xsl:text>Warning: glossary.collection specified, but there are </xsl:text>
  861. <xsl:value-of select="count($glossary)"/>
  862. <xsl:text> automatic glossaries</xsl:text>
  863. </xsl:message>
  864. </xsl:if>
  865. <xsl:variable name="glosschunk">
  866. <xsl:call-template name="href.target">
  867. <xsl:with-param name="object" select="$glossary"/>
  868. </xsl:call-template>
  869. </xsl:variable>
  870. <xsl:variable name="chunkbase">
  871. <xsl:choose>
  872. <xsl:when test="contains($glosschunk, '#')">
  873. <xsl:value-of select="substring-before($glosschunk, '#')"/>
  874. </xsl:when>
  875. <xsl:otherwise>
  876. <xsl:value-of select="$glosschunk"/>
  877. </xsl:otherwise>
  878. </xsl:choose>
  879. </xsl:variable>
  880. <xsl:choose>
  881. <xsl:when test="not($cterm)">
  882. <xsl:message>
  883. <xsl:text>There's no entry for </xsl:text>
  884. <xsl:value-of select="$term"/>
  885. <xsl:text> in </xsl:text>
  886. <xsl:value-of select="$glossary.collection"/>
  887. </xsl:message>
  888. <xsl:call-template name="inline.italicseq"/>
  889. </xsl:when>
  890. <xsl:otherwise>
  891. <xsl:variable name="id">
  892. <xsl:call-template name="object.id">
  893. <xsl:with-param name="object" select="$cterm"/>
  894. </xsl:call-template>
  895. </xsl:variable>
  896. <a href="{$chunkbase}#{$id}">
  897. <xsl:apply-templates select="." mode="common.html.attributes"/>
  898. <xsl:call-template name="inline.italicseq">
  899. <xsl:with-param name="content" select="$content"/>
  900. </xsl:call-template>
  901. </a>
  902. </xsl:otherwise>
  903. </xsl:choose>
  904. </xsl:when>
  905. <xsl:when test="not(@linkend)
  906. and ($firstterm.only.link = 0 or $firstterm = 1)
  907. and $glossterm.auto.link != 0">
  908. <xsl:variable name="term">
  909. <xsl:choose>
  910. <xsl:when test="@baseform">
  911. <xsl:value-of select="normalize-space(@baseform)"/>
  912. </xsl:when>
  913. <xsl:otherwise>
  914. <xsl:value-of select="normalize-space(.)"/>
  915. </xsl:otherwise>
  916. </xsl:choose>
  917. </xsl:variable>
  918. <xsl:variable name="targets"
  919. select="key('glossentries', $term)"/>
  920. <xsl:variable name="target" select="$targets[1]"/>
  921. <xsl:choose>
  922. <xsl:when test="count($targets)=0">
  923. <xsl:message>
  924. <xsl:text>Error: no glossentry for glossterm: </xsl:text>
  925. <xsl:value-of select="."/>
  926. <xsl:text>.</xsl:text>
  927. </xsl:message>
  928. <xsl:call-template name="inline.italicseq"/>
  929. </xsl:when>
  930. <xsl:otherwise>
  931. <a>
  932. <xsl:apply-templates select="." mode="common.html.attributes"/>
  933. <xsl:if test="@id or @xml:id">
  934. <xsl:attribute name="name">
  935. <xsl:value-of select="(@id|@xml:id)[1]"/>
  936. </xsl:attribute>
  937. </xsl:if>
  938. <xsl:attribute name="href">
  939. <xsl:call-template name="href.target">
  940. <xsl:with-param name="object" select="$target"/>
  941. </xsl:call-template>
  942. </xsl:attribute>
  943. <xsl:call-template name="inline.italicseq">
  944. <xsl:with-param name="content" select="$content"/>
  945. </xsl:call-template>
  946. </a>
  947. </xsl:otherwise>
  948. </xsl:choose>
  949. </xsl:when>
  950. <xsl:otherwise>
  951. <xsl:call-template name="inline.italicseq"/>
  952. </xsl:otherwise>
  953. </xsl:choose>
  954. </xsl:template>
  955. <xsl:template match="termdef">
  956. <span>
  957. <xsl:apply-templates select="." mode="common.html.attributes"/>
  958. <xsl:call-template name="gentext.template">
  959. <xsl:with-param name="context" select="'termdef'"/>
  960. <xsl:with-param name="name" select="'prefix'"/>
  961. </xsl:call-template>
  962. <xsl:apply-templates/>
  963. <xsl:call-template name="gentext.template">
  964. <xsl:with-param name="context" select="'termdef'"/>
  965. <xsl:with-param name="name" select="'suffix'"/>
  966. </xsl:call-template>
  967. </span>
  968. </xsl:template>
  969. <xsl:template match="sgmltag|tag">
  970. <xsl:call-template name="format.sgmltag"/>
  971. </xsl:template>
  972. <xsl:template name="format.sgmltag">
  973. <xsl:param name="class">
  974. <xsl:choose>
  975. <xsl:when test="@class">
  976. <xsl:value-of select="@class"/>
  977. </xsl:when>
  978. <xsl:otherwise>element</xsl:otherwise>
  979. </xsl:choose>
  980. </xsl:param>
  981. <xsl:variable name="content">
  982. <xsl:choose>
  983. <xsl:when test="$class='attribute'">
  984. <xsl:apply-templates/>
  985. </xsl:when>
  986. <xsl:when test="$class='attvalue'">
  987. <xsl:apply-templates/>
  988. </xsl:when>
  989. <xsl:when test="$class='element'">
  990. <xsl:apply-templates/>
  991. </xsl:when>
  992. <xsl:when test="$class='endtag'">
  993. <xsl:text>&lt;/</xsl:text>
  994. <xsl:apply-templates/>
  995. <xsl:text>&gt;</xsl:text>
  996. </xsl:when>
  997. <xsl:when test="$class='genentity'">
  998. <xsl:text>&amp;</xsl:text>
  999. <xsl:apply-templates/>
  1000. <xsl:text>;</xsl:text>
  1001. </xsl:when>
  1002. <xsl:when test="$class='numcharref'">
  1003. <xsl:text>&amp;#</xsl:text>
  1004. <xsl:apply-templates/>
  1005. <xsl:text>;</xsl:text>
  1006. </xsl:when>
  1007. <xsl:when test="$class='paramentity'">
  1008. <xsl:text>%</xsl:text>
  1009. <xsl:apply-templates/>
  1010. <xsl:text>;</xsl:text>
  1011. </xsl:when>
  1012. <xsl:when test="$class='pi'">
  1013. <xsl:text>&lt;?</xsl:text>
  1014. <xsl:apply-templates/>
  1015. <xsl:text>&gt;</xsl:text>
  1016. </xsl:when>
  1017. <xsl:when test="$class='xmlpi'">
  1018. <xsl:text>&lt;?</xsl:text>
  1019. <xsl:apply-templates/>
  1020. <xsl:text>?&gt;</xsl:text>
  1021. </xsl:when>
  1022. <xsl:when test="$class='starttag'">
  1023. <xsl:text>&lt;</xsl:text>
  1024. <xsl:apply-templates/>
  1025. <xsl:text>&gt;</xsl:text>
  1026. </xsl:when>
  1027. <xsl:when test="$class='emptytag'">
  1028. <xsl:text>&lt;</xsl:text>
  1029. <xsl:apply-templates/>
  1030. <xsl:text>/&gt;</xsl:text>
  1031. </xsl:when>
  1032. <xsl:when test="$class='sgmlcomment' or $class='comment'">
  1033. <xsl:text>&lt;!--</xsl:text>
  1034. <xsl:apply-templates/>
  1035. <xsl:text>--&gt;</xsl:text>
  1036. </xsl:when>
  1037. <xsl:otherwise>
  1038. <xsl:apply-templates/>
  1039. </xsl:otherwise>
  1040. </xsl:choose>
  1041. </xsl:variable>
  1042. <code>
  1043. <xsl:apply-templates select="." mode="common.html.attributes">
  1044. <xsl:with-param name="class" select="concat('sgmltag-', $class)"/>
  1045. </xsl:apply-templates>
  1046. <xsl:call-template name="simple.xlink">
  1047. <xsl:with-param name="content" select="$content"/>
  1048. </xsl:call-template>
  1049. </code>
  1050. </xsl:template>
  1051. <xsl:template match="email">
  1052. <xsl:call-template name="inline.monoseq">
  1053. <xsl:with-param name="content">
  1054. <xsl:if test="not($email.delimiters.enabled = 0)">
  1055. <xsl:text>&lt;</xsl:text>
  1056. </xsl:if>
  1057. <a>
  1058. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1059. <xsl:call-template name="id.attribute"/>
  1060. <xsl:attribute name="href">
  1061. <xsl:text>mailto:</xsl:text>
  1062. <xsl:value-of select="."/>
  1063. </xsl:attribute>
  1064. <xsl:apply-templates/>
  1065. </a>
  1066. <xsl:if test="not($email.delimiters.enabled = 0)">
  1067. <xsl:text>&gt;</xsl:text>
  1068. </xsl:if>
  1069. </xsl:with-param>
  1070. </xsl:call-template>
  1071. </xsl:template>
  1072. <xsl:template match="keycombo">
  1073. <xsl:variable name="action" select="@action"/>
  1074. <xsl:variable name="joinchar">
  1075. <xsl:choose>
  1076. <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
  1077. <xsl:when test="$action='simul'">+</xsl:when>
  1078. <xsl:when test="$action='press'">-</xsl:when>
  1079. <xsl:when test="$action='click'">-</xsl:when>
  1080. <xsl:when test="$action='double-click'">-</xsl:when>
  1081. <xsl:when test="$action='other'"></xsl:when>
  1082. <xsl:otherwise>+</xsl:otherwise>
  1083. </xsl:choose>
  1084. </xsl:variable>
  1085. <xsl:for-each select="*">
  1086. <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
  1087. <xsl:apply-templates select="."/>
  1088. </xsl:for-each>
  1089. </xsl:template>
  1090. <xsl:template match="uri">
  1091. <xsl:call-template name="inline.monoseq"/>
  1092. </xsl:template>
  1093. <!-- ==================================================================== -->
  1094. <xsl:template match="menuchoice">
  1095. <xsl:variable name="shortcut" select="./shortcut"/>
  1096. <xsl:call-template name="process.menuchoice"/>
  1097. <xsl:if test="$shortcut">
  1098. <xsl:text> (</xsl:text>
  1099. <xsl:apply-templates select="$shortcut"/>
  1100. <xsl:text>)</xsl:text>
  1101. </xsl:if>
  1102. </xsl:template>
  1103. <xsl:template name="process.menuchoice">
  1104. <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
  1105. <xsl:param name="count" select="1"/>
  1106. <xsl:choose>
  1107. <xsl:when test="$count>count($nodelist)"></xsl:when>
  1108. <xsl:when test="$count=1">
  1109. <xsl:apply-templates select="$nodelist[$count=position()]"/>
  1110. <xsl:call-template name="process.menuchoice">
  1111. <xsl:with-param name="nodelist" select="$nodelist"/>
  1112. <xsl:with-param name="count" select="$count+1"/>
  1113. </xsl:call-template>
  1114. </xsl:when>
  1115. <xsl:otherwise>
  1116. <xsl:variable name="node" select="$nodelist[$count=position()]"/>
  1117. <xsl:choose>
  1118. <xsl:when test="local-name($node)='guimenuitem'
  1119. or local-name($node)='guisubmenu'">
  1120. <xsl:value-of select="$menuchoice.menu.separator"/>
  1121. </xsl:when>
  1122. <xsl:otherwise>
  1123. <xsl:value-of select="$menuchoice.separator"/>
  1124. </xsl:otherwise>
  1125. </xsl:choose>
  1126. <xsl:apply-templates select="$node"/>
  1127. <xsl:call-template name="process.menuchoice">
  1128. <xsl:with-param name="nodelist" select="$nodelist"/>
  1129. <xsl:with-param name="count" select="$count+1"/>
  1130. </xsl:call-template>
  1131. </xsl:otherwise>
  1132. </xsl:choose>
  1133. </xsl:template>
  1134. <!-- ==================================================================== -->
  1135. <xsl:template match="optional">
  1136. <xsl:value-of select="$arg.choice.opt.open.str"/>
  1137. <xsl:call-template name="inline.charseq"/>
  1138. <xsl:value-of select="$arg.choice.opt.close.str"/>
  1139. </xsl:template>
  1140. <xsl:template match="citation">
  1141. <!-- todo: integrate with bibliography collection -->
  1142. <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
  1143. <xsl:variable name="target" select="$targets[1]"/>
  1144. <xsl:choose>
  1145. <!-- try automatic linking based on match to abbrev -->
  1146. <xsl:when test="$target and not(xref) and not(link)">
  1147. <xsl:text>[</xsl:text>
  1148. <a>
  1149. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1150. <xsl:attribute name="href">
  1151. <xsl:call-template name="href.target">
  1152. <xsl:with-param name="object" select="$target"/>
  1153. </xsl:call-template>
  1154. </xsl:attribute>
  1155. <xsl:choose>
  1156. <xsl:when test="$bibliography.numbered != 0">
  1157. <xsl:call-template name="id.attribute"/>
  1158. <xsl:apply-templates select="$target" mode="citation"/>
  1159. </xsl:when>
  1160. <xsl:otherwise>
  1161. <xsl:call-template name="inline.charseq"/>
  1162. </xsl:otherwise>
  1163. </xsl:choose>
  1164. </a>
  1165. <xsl:text>]</xsl:text>
  1166. </xsl:when>
  1167. <xsl:otherwise>
  1168. <xsl:text>[</xsl:text>
  1169. <xsl:call-template name="inline.charseq"/>
  1170. <xsl:text>]</xsl:text>
  1171. </xsl:otherwise>
  1172. </xsl:choose>
  1173. </xsl:template>
  1174. <xsl:template match="citebiblioid">
  1175. <xsl:variable name="targets" select="//*[biblioid = string(current())]"/>
  1176. <xsl:variable name="target" select="$targets[1]"/>
  1177. <xsl:choose>
  1178. <!-- try automatic linking based on match to parent of biblioid -->
  1179. <xsl:when test="$target and not(xref) and not(link)">
  1180. <xsl:text>[</xsl:text>
  1181. <a>
  1182. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1183. <xsl:attribute name="href">
  1184. <xsl:call-template name="href.target">
  1185. <xsl:with-param name="object" select="$target"/>
  1186. </xsl:call-template>
  1187. </xsl:attribute>
  1188. <xsl:call-template name="inline.charseq"/>
  1189. </a>
  1190. <xsl:text>]</xsl:text>
  1191. </xsl:when>
  1192. <xsl:otherwise>
  1193. <xsl:text>[</xsl:text>
  1194. <xsl:call-template name="inline.charseq"/>
  1195. <xsl:text>]</xsl:text>
  1196. </xsl:otherwise>
  1197. </xsl:choose>
  1198. </xsl:template>
  1199. <xsl:template match="biblioentry|bibliomixed" mode="citation">
  1200. <xsl:number from="bibliography" count="biblioentry|bibliomixed"
  1201. level="any" format="1"/>
  1202. </xsl:template>
  1203. <!-- ==================================================================== -->
  1204. <xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
  1205. <xsl:if test="$show.comments != 0">
  1206. <p class="remark"><em><xsl:call-template name="inline.charseq"/></em></p>
  1207. </xsl:if>
  1208. </xsl:template>
  1209. <xsl:template match="comment|remark">
  1210. <xsl:if test="$show.comments != 0">
  1211. <em><xsl:call-template name="inline.charseq"/></em>
  1212. </xsl:if>
  1213. </xsl:template>
  1214. <!-- ==================================================================== -->
  1215. <xsl:template match="productname">
  1216. <xsl:call-template name="inline.charseq"/>
  1217. <xsl:if test="@class">
  1218. <xsl:call-template name="dingbat">
  1219. <xsl:with-param name="dingbat" select="@class"/>
  1220. </xsl:call-template>
  1221. </xsl:if>
  1222. </xsl:template>
  1223. <xsl:template match="productnumber">
  1224. <xsl:call-template name="inline.charseq"/>
  1225. </xsl:template>
  1226. <!-- ==================================================================== -->
  1227. <xsl:template match="pob|street|city|state|postcode|country|otheraddr">
  1228. <xsl:call-template name="inline.charseq"/>
  1229. </xsl:template>
  1230. <xsl:template match="phone|fax">
  1231. <xsl:call-template name="inline.charseq"/>
  1232. </xsl:template>
  1233. <!-- in Addresses, for example -->
  1234. <xsl:template match="honorific|firstname|surname|lineage|othername">
  1235. <xsl:call-template name="inline.charseq"/>
  1236. </xsl:template>
  1237. <!-- ==================================================================== -->
  1238. <xsl:template match="person">
  1239. <xsl:param name="content">
  1240. <xsl:call-template name="anchor"/>
  1241. <xsl:call-template name="simple.xlink">
  1242. <xsl:with-param name="content">
  1243. <xsl:apply-templates select="personname"/>
  1244. </xsl:with-param>
  1245. </xsl:call-template>
  1246. <xsl:call-template name="apply-annotations"/>
  1247. </xsl:param>
  1248. <span>
  1249. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1250. <xsl:call-template name="id.attribute"/>
  1251. <xsl:copy-of select="$content"/>
  1252. </span>
  1253. </xsl:template>
  1254. <xsl:template match="personname">
  1255. <xsl:param name="content">
  1256. <xsl:call-template name="anchor"/>
  1257. <xsl:call-template name="simple.xlink">
  1258. <xsl:with-param name="content">
  1259. <xsl:call-template name="person.name"/>
  1260. </xsl:with-param>
  1261. </xsl:call-template>
  1262. <xsl:call-template name="apply-annotations"/>
  1263. </xsl:param>
  1264. <span>
  1265. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1266. <xsl:call-template name="id.attribute"/>
  1267. <xsl:copy-of select="$content"/>
  1268. </span>
  1269. </xsl:template>
  1270. <!-- ==================================================================== -->
  1271. <xsl:template match="org">
  1272. <xsl:param name="content">
  1273. <xsl:call-template name="anchor"/>
  1274. <xsl:call-template name="simple.xlink">
  1275. <xsl:with-param name="content">
  1276. <xsl:apply-templates/>
  1277. </xsl:with-param>
  1278. </xsl:call-template>
  1279. <xsl:call-template name="apply-annotations"/>
  1280. </xsl:param>
  1281. <span>
  1282. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1283. <xsl:call-template name="id.attribute"/>
  1284. <xsl:copy-of select="$content"/>
  1285. </span>
  1286. </xsl:template>
  1287. <xsl:template match="orgname">
  1288. <xsl:param name="content">
  1289. <xsl:call-template name="anchor"/>
  1290. <xsl:call-template name="simple.xlink">
  1291. <xsl:with-param name="content">
  1292. <xsl:apply-templates/>
  1293. </xsl:with-param>
  1294. </xsl:call-template>
  1295. <xsl:call-template name="apply-annotations"/>
  1296. </xsl:param>
  1297. <span>
  1298. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1299. <xsl:call-template name="id.attribute"/>
  1300. <xsl:copy-of select="$content"/>
  1301. </span>
  1302. </xsl:template>
  1303. <xsl:template match="orgdiv">
  1304. <xsl:param name="content">
  1305. <xsl:call-template name="anchor"/>
  1306. <xsl:call-template name="simple.xlink">
  1307. <xsl:with-param name="content">
  1308. <xsl:apply-templates/>
  1309. </xsl:with-param>
  1310. </xsl:call-template>
  1311. <xsl:call-template name="apply-annotations"/>
  1312. </xsl:param>
  1313. <span>
  1314. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1315. <xsl:copy-of select="$content"/>
  1316. </span>
  1317. </xsl:template>
  1318. <xsl:template match="affiliation">
  1319. <xsl:param name="content">
  1320. <xsl:call-template name="anchor"/>
  1321. <xsl:call-template name="simple.xlink">
  1322. <xsl:with-param name="content">
  1323. <xsl:call-template name="person.name"/>
  1324. </xsl:with-param>
  1325. </xsl:call-template>
  1326. <xsl:call-template name="apply-annotations"/>
  1327. </xsl:param>
  1328. <span>
  1329. <xsl:apply-templates select="." mode="common.html.attributes"/>
  1330. <xsl:call-template name="id.attribute"/>
  1331. <xsl:copy-of select="$content"/>
  1332. </span>
  1333. </xsl:template>
  1334. <!-- ==================================================================== -->
  1335. <xsl:template match="beginpage">
  1336. <!-- does nothing; this *is not* markup to force a page break. -->
  1337. </xsl:template>
  1338. </xsl:stylesheet>