synop.xsl 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  5. <!-- ********************************************************************
  6. $Id$
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <!-- ==================================================================== -->
  13. <!-- synopsis is in verbatim -->
  14. <!-- ==================================================================== -->
  15. <xsl:template match="cmdsynopsis">
  16. <div>
  17. <xsl:apply-templates select="." mode="class.attribute"/>
  18. <p>
  19. <xsl:call-template name="anchor">
  20. <xsl:with-param name="conditional" select="0"/>
  21. </xsl:call-template>
  22. <xsl:apply-templates/>
  23. </p>
  24. </div>
  25. </xsl:template>
  26. <xsl:template match="cmdsynopsis/command">
  27. <br/>
  28. <xsl:call-template name="inline.monoseq"/>
  29. <xsl:text> </xsl:text>
  30. </xsl:template>
  31. <xsl:template match="cmdsynopsis/command[1]" priority="2">
  32. <xsl:call-template name="inline.monoseq"/>
  33. <xsl:text> </xsl:text>
  34. </xsl:template>
  35. <xsl:template match="group|arg" name="group-or-arg">
  36. <xsl:variable name="choice" select="@choice"/>
  37. <xsl:variable name="rep" select="@rep"/>
  38. <xsl:variable name="sepchar">
  39. <xsl:choose>
  40. <xsl:when test="ancestor-or-self::*/@sepchar">
  41. <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
  42. </xsl:when>
  43. <xsl:otherwise>
  44. <xsl:text> </xsl:text>
  45. </xsl:otherwise>
  46. </xsl:choose>
  47. </xsl:variable>
  48. <xsl:if test="preceding-sibling::*">
  49. <xsl:value-of select="$sepchar"/>
  50. </xsl:if>
  51. <xsl:choose>
  52. <xsl:when test="$choice='plain'">
  53. <xsl:value-of select="$arg.choice.plain.open.str"/>
  54. </xsl:when>
  55. <xsl:when test="$choice='req'">
  56. <xsl:value-of select="$arg.choice.req.open.str"/>
  57. </xsl:when>
  58. <xsl:when test="$choice='opt'">
  59. <xsl:value-of select="$arg.choice.opt.open.str"/>
  60. </xsl:when>
  61. <xsl:otherwise>
  62. <xsl:value-of select="$arg.choice.def.open.str"/>
  63. </xsl:otherwise>
  64. </xsl:choose>
  65. <xsl:apply-templates/>
  66. <xsl:choose>
  67. <xsl:when test="$rep='repeat'">
  68. <xsl:value-of select="$arg.rep.repeat.str"/>
  69. </xsl:when>
  70. <xsl:when test="$rep='norepeat'">
  71. <xsl:value-of select="$arg.rep.norepeat.str"/>
  72. </xsl:when>
  73. <xsl:otherwise>
  74. <xsl:value-of select="$arg.rep.def.str"/>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. <xsl:choose>
  78. <xsl:when test="$choice='plain'">
  79. <xsl:value-of select="$arg.choice.plain.close.str"/>
  80. </xsl:when>
  81. <xsl:when test="$choice='req'">
  82. <xsl:value-of select="$arg.choice.req.close.str"/>
  83. </xsl:when>
  84. <xsl:when test="$choice='opt'">
  85. <xsl:value-of select="$arg.choice.opt.close.str"/>
  86. </xsl:when>
  87. <xsl:otherwise>
  88. <xsl:value-of select="$arg.choice.def.close.str"/>
  89. </xsl:otherwise>
  90. </xsl:choose>
  91. </xsl:template>
  92. <xsl:template match="group/arg">
  93. <xsl:variable name="choice" select="@choice"/>
  94. <xsl:variable name="rep" select="@rep"/>
  95. <xsl:if test="preceding-sibling::*">
  96. <xsl:value-of select="$arg.or.sep"/>
  97. </xsl:if>
  98. <xsl:call-template name="group-or-arg"/>
  99. </xsl:template>
  100. <xsl:template match="sbr">
  101. <br/>
  102. </xsl:template>
  103. <!-- ==================================================================== -->
  104. <xsl:template match="synopfragmentref">
  105. <xsl:variable name="target" select="key('id',@linkend)"/>
  106. <xsl:variable name="snum">
  107. <xsl:apply-templates select="$target" mode="synopfragment.number"/>
  108. </xsl:variable>
  109. <i>
  110. <a href="#{@linkend}">
  111. <xsl:text>(</xsl:text>
  112. <xsl:value-of select="$snum"/>
  113. <xsl:text>)</xsl:text>
  114. </a>
  115. <xsl:text>&#160;</xsl:text>
  116. <xsl:apply-templates/>
  117. </i>
  118. </xsl:template>
  119. <xsl:template match="synopfragment" mode="synopfragment.number">
  120. <xsl:number format="1"/>
  121. </xsl:template>
  122. <xsl:template match="synopfragment">
  123. <xsl:variable name="snum">
  124. <xsl:apply-templates select="." mode="synopfragment.number"/>
  125. </xsl:variable>
  126. <p>
  127. <xsl:variable name="id">
  128. <xsl:call-template name="object.id"/>
  129. </xsl:variable>
  130. <a id="{$id}">
  131. <xsl:text>(</xsl:text>
  132. <xsl:value-of select="$snum"/>
  133. <xsl:text>)</xsl:text>
  134. </a>
  135. <xsl:text> </xsl:text>
  136. <xsl:apply-templates/>
  137. </p>
  138. </xsl:template>
  139. <xsl:template match="funcsynopsis">
  140. <xsl:call-template name="informal.object"/>
  141. </xsl:template>
  142. <xsl:template match="funcsynopsisinfo">
  143. <pre>
  144. <xsl:apply-templates select="." mode="class.attribute"/>
  145. <xsl:apply-templates/>
  146. </pre>
  147. </xsl:template>
  148. <!-- ====================================================================== -->
  149. <!-- funcprototype -->
  150. <!--
  151. funcprototype ::= (funcdef,
  152. (void|varargs|paramdef+))
  153. funcdef ::= (#PCDATA|type|replaceable|function)*
  154. paramdef ::= (#PCDATA|type|replaceable|parameter|funcparams)*
  155. -->
  156. <xsl:template match="funcprototype">
  157. <xsl:variable name="html-style">
  158. <xsl:call-template name="pi.dbhtml_funcsynopsis-style">
  159. <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-self::*"/>
  160. </xsl:call-template>
  161. </xsl:variable>
  162. <xsl:variable name="style">
  163. <xsl:choose>
  164. <xsl:when test="$html-style != ''">
  165. <xsl:value-of select="$html-style"/>
  166. </xsl:when>
  167. <xsl:otherwise>
  168. <xsl:value-of select="$funcsynopsis.style"/>
  169. </xsl:otherwise>
  170. </xsl:choose>
  171. </xsl:variable>
  172. <!--
  173. <xsl:variable name="tabular-p"
  174. select="$funcsynopsis.tabular.threshold &gt; 0
  175. and string-length(.) &gt; $funcsynopsis.tabular.threshold"/>
  176. -->
  177. <xsl:variable name="tabular-p" select="true()"/>
  178. <xsl:choose>
  179. <xsl:when test="$style = 'kr' and $tabular-p">
  180. <xsl:apply-templates select="." mode="kr-tabular"/>
  181. </xsl:when>
  182. <xsl:when test="$style = 'kr'">
  183. <xsl:apply-templates select="." mode="kr-nontabular"/>
  184. </xsl:when>
  185. <xsl:when test="$style = 'ansi' and $tabular-p">
  186. <xsl:apply-templates select="." mode="ansi-tabular"/>
  187. </xsl:when>
  188. <xsl:otherwise>
  189. <xsl:apply-templates select="." mode="ansi-nontabular"/>
  190. </xsl:otherwise>
  191. </xsl:choose>
  192. </xsl:template>
  193. <!-- ====================================================================== -->
  194. <!-- funcprototype: kr, non-tabular -->
  195. <xsl:template match="funcprototype" mode="kr-nontabular">
  196. <p>
  197. <xsl:apply-templates mode="kr-nontabular"/>
  198. <xsl:if test="paramdef">
  199. <br/>
  200. <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
  201. </xsl:if>
  202. </p>
  203. </xsl:template>
  204. <xsl:template match="funcdef" mode="kr-nontabular">
  205. <code>
  206. <xsl:apply-templates select="." mode="class.attribute"/>
  207. <xsl:apply-templates mode="kr-nontabular"/>
  208. <xsl:text>(</xsl:text>
  209. </code>
  210. </xsl:template>
  211. <xsl:template match="funcdef/function" mode="kr-nontabular">
  212. <xsl:choose>
  213. <xsl:when test="$funcsynopsis.decoration != 0">
  214. <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
  215. </xsl:when>
  216. <xsl:otherwise>
  217. <xsl:apply-templates mode="kr-nontabular"/>
  218. </xsl:otherwise>
  219. </xsl:choose>
  220. </xsl:template>
  221. <xsl:template match="void" mode="kr-nontabular">
  222. <code>)</code>
  223. <xsl:text>;</xsl:text>
  224. </xsl:template>
  225. <xsl:template match="varargs" mode="kr-nontabular">
  226. <xsl:text>...</xsl:text>
  227. <code>)</code>
  228. <xsl:text>;</xsl:text>
  229. </xsl:template>
  230. <xsl:template match="paramdef" mode="kr-nontabular">
  231. <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
  232. <xsl:choose>
  233. <xsl:when test="following-sibling::*">
  234. <xsl:text>, </xsl:text>
  235. </xsl:when>
  236. <xsl:otherwise>
  237. <code>)</code>
  238. <xsl:text>;</xsl:text>
  239. </xsl:otherwise>
  240. </xsl:choose>
  241. </xsl:template>
  242. <xsl:template match="paramdef/parameter" mode="kr-nontabular">
  243. <xsl:choose>
  244. <xsl:when test="$funcsynopsis.decoration != 0">
  245. <var class="pdparam">
  246. <xsl:apply-templates mode="kr-nontabular"/>
  247. </var>
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <code>
  251. <xsl:apply-templates mode="kr-nontabular"/>
  252. </code>
  253. </xsl:otherwise>
  254. </xsl:choose>
  255. </xsl:template>
  256. <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
  257. <xsl:if test="preceding-sibling::paramdef"><br/></xsl:if>
  258. <code>
  259. <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
  260. </code>
  261. <xsl:text>;</xsl:text>
  262. </xsl:template>
  263. <xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
  264. <xsl:choose>
  265. <xsl:when test="$funcsynopsis.decoration != 0">
  266. <var class="pdparam">
  267. <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
  268. </var>
  269. </xsl:when>
  270. <xsl:otherwise>
  271. <code>
  272. <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
  273. </code>
  274. </xsl:otherwise>
  275. </xsl:choose>
  276. </xsl:template>
  277. <xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
  278. <code>(</code>
  279. <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
  280. <code>)</code>
  281. </xsl:template>
  282. <!-- ====================================================================== -->
  283. <!-- funcprototype: kr, tabular -->
  284. <xsl:template match="funcprototype" mode="kr-tabular">
  285. <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
  286. <tr>
  287. <td>
  288. <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
  289. </td>
  290. <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
  291. </tr>
  292. <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
  293. <tr>
  294. <td>&#160;</td>
  295. <xsl:apply-templates select="." mode="kr-tabular"/>
  296. </tr>
  297. </xsl:for-each>
  298. </table>
  299. <xsl:if test="paramdef">
  300. <table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0">
  301. <xsl:if test="following-sibling::funcprototype">
  302. <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
  303. </xsl:if>
  304. <xsl:apply-templates select="paramdef" mode="kr-tabular-funcsynopsis-mode"/>
  305. </table>
  306. </xsl:if>
  307. </xsl:template>
  308. <xsl:template match="funcdef" mode="kr-tabular">
  309. <code>
  310. <xsl:apply-templates select="." mode="class.attribute"/>
  311. <xsl:apply-templates mode="kr-tabular"/>
  312. <xsl:text>(</xsl:text>
  313. </code>
  314. </xsl:template>
  315. <xsl:template match="funcdef/function" mode="kr-tabular">
  316. <xsl:choose>
  317. <xsl:when test="$funcsynopsis.decoration != 0">
  318. <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
  319. </xsl:when>
  320. <xsl:otherwise>
  321. <xsl:apply-templates mode="kr-tabular"/>
  322. </xsl:otherwise>
  323. </xsl:choose>
  324. </xsl:template>
  325. <xsl:template match="void" mode="kr-tabular">
  326. <td>
  327. <code>)</code>
  328. <xsl:text>;</xsl:text>
  329. </td>
  330. <td>&#160;</td>
  331. </xsl:template>
  332. <xsl:template match="varargs" mode="kr-tabular">
  333. <td>
  334. <xsl:text>...</xsl:text>
  335. <code>)</code>
  336. <xsl:text>;</xsl:text>
  337. </td>
  338. <td>&#160;</td>
  339. </xsl:template>
  340. <xsl:template match="paramdef" mode="kr-tabular">
  341. <td>
  342. <xsl:apply-templates select="parameter" mode="kr-tabular"/>
  343. <xsl:choose>
  344. <xsl:when test="following-sibling::*">
  345. <xsl:text>, </xsl:text>
  346. </xsl:when>
  347. <xsl:otherwise>
  348. <code>)</code>
  349. <xsl:text>;</xsl:text>
  350. </xsl:otherwise>
  351. </xsl:choose>
  352. </td>
  353. <td>&#160;</td>
  354. </xsl:template>
  355. <xsl:template match="paramdef/parameter" mode="kr-tabular">
  356. <xsl:choose>
  357. <xsl:when test="$funcsynopsis.decoration != 0">
  358. <var class="pdparam">
  359. <xsl:apply-templates mode="kr-tabular"/>
  360. </var>
  361. </xsl:when>
  362. <xsl:otherwise>
  363. <code>
  364. <xsl:apply-templates mode="kr-tabular"/>
  365. </code>
  366. </xsl:otherwise>
  367. </xsl:choose>
  368. </xsl:template>
  369. <xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
  370. <xsl:variable name="type">
  371. <xsl:choose>
  372. <xsl:when test="type">
  373. <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
  374. </xsl:when>
  375. <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
  376. <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
  377. </xsl:when>
  378. </xsl:choose>
  379. </xsl:variable>
  380. <tr>
  381. <xsl:choose>
  382. <xsl:when test="$type != '' and funcparams">
  383. <td>
  384. <code>
  385. <xsl:copy-of select="$type"/>
  386. </code>
  387. <xsl:text>&#160;</xsl:text>
  388. </td>
  389. <td>
  390. <code>
  391. <xsl:choose>
  392. <xsl:when test="type">
  393. <xsl:apply-templates select="type/following-sibling::*" mode="kr-tabular-funcsynopsis-mode"/>
  394. </xsl:when>
  395. <xsl:otherwise>
  396. <xsl:apply-templates select="*" mode="kr-tabular-funcsynopsis-mode"/>
  397. </xsl:otherwise>
  398. </xsl:choose>
  399. </code>
  400. </td>
  401. </xsl:when>
  402. <xsl:when test="funcparams">
  403. <td colspan="2">
  404. <code>
  405. <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
  406. </code>
  407. </td>
  408. </xsl:when>
  409. <xsl:otherwise>
  410. <td>
  411. <code>
  412. <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
  413. </code>
  414. <xsl:text>&#160;</xsl:text>
  415. </td>
  416. <td>
  417. <code>
  418. <xsl:apply-templates select="parameter" mode="kr-tabular"/>
  419. <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
  420. <xsl:text>;</xsl:text>
  421. </code>
  422. </td>
  423. </xsl:otherwise>
  424. </xsl:choose>
  425. </tr>
  426. </xsl:template>
  427. <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
  428. <xsl:choose>
  429. <xsl:when test="$funcsynopsis.decoration != 0">
  430. <var class="pdparam">
  431. <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
  432. </var>
  433. </xsl:when>
  434. <xsl:otherwise>
  435. <code>
  436. <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
  437. </code>
  438. </xsl:otherwise>
  439. </xsl:choose>
  440. </xsl:template>
  441. <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
  442. <code>(</code>
  443. <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
  444. <code>)</code>
  445. <xsl:text>;</xsl:text>
  446. </xsl:template>
  447. <!-- ====================================================================== -->
  448. <!-- funcprototype: ansi, non-tabular -->
  449. <xsl:template match="funcprototype" mode="ansi-nontabular">
  450. <p>
  451. <xsl:apply-templates mode="ansi-nontabular"/>
  452. </p>
  453. </xsl:template>
  454. <xsl:template match="funcdef" mode="ansi-nontabular">
  455. <code>
  456. <xsl:apply-templates select="." mode="class.attribute"/>
  457. <xsl:apply-templates mode="ansi-nontabular"/>
  458. <xsl:text>(</xsl:text>
  459. </code>
  460. </xsl:template>
  461. <xsl:template match="funcdef/function" mode="ansi-nontabular">
  462. <xsl:choose>
  463. <xsl:when test="$funcsynopsis.decoration != 0">
  464. <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
  465. </xsl:when>
  466. <xsl:otherwise>
  467. <xsl:apply-templates mode="ansi-nontabular"/>
  468. </xsl:otherwise>
  469. </xsl:choose>
  470. </xsl:template>
  471. <xsl:template match="void" mode="ansi-nontabular">
  472. <code>void)</code>
  473. <xsl:text>;</xsl:text>
  474. </xsl:template>
  475. <xsl:template match="varargs" mode="ansi-nontabular">
  476. <xsl:text>...</xsl:text>
  477. <code>)</code>
  478. <xsl:text>;</xsl:text>
  479. </xsl:template>
  480. <xsl:template match="paramdef" mode="ansi-nontabular">
  481. <xsl:apply-templates mode="ansi-nontabular"/>
  482. <xsl:choose>
  483. <xsl:when test="following-sibling::*">
  484. <xsl:text>, </xsl:text>
  485. </xsl:when>
  486. <xsl:otherwise>
  487. <code>)</code>
  488. <xsl:text>;</xsl:text>
  489. </xsl:otherwise>
  490. </xsl:choose>
  491. </xsl:template>
  492. <xsl:template match="paramdef/parameter" mode="ansi-nontabular">
  493. <xsl:choose>
  494. <xsl:when test="$funcsynopsis.decoration != 0">
  495. <var class="pdparam">
  496. <xsl:apply-templates mode="ansi-nontabular"/>
  497. </var>
  498. </xsl:when>
  499. <xsl:otherwise>
  500. <code>
  501. <xsl:apply-templates mode="ansi-nontabular"/>
  502. </code>
  503. </xsl:otherwise>
  504. </xsl:choose>
  505. </xsl:template>
  506. <xsl:template match="funcparams" mode="ansi-nontabular">
  507. <code>(</code>
  508. <xsl:apply-templates mode="ansi-nontabular"/>
  509. <code>)</code>
  510. </xsl:template>
  511. <!-- ====================================================================== -->
  512. <!-- funcprototype: ansi, tabular -->
  513. <xsl:template match="funcprototype" mode="ansi-tabular">
  514. <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
  515. <xsl:if test="following-sibling::funcprototype">
  516. <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
  517. </xsl:if>
  518. <tr>
  519. <td>
  520. <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
  521. </td>
  522. <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
  523. </tr>
  524. <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
  525. <tr>
  526. <td>&#160;</td>
  527. <xsl:apply-templates select="." mode="ansi-tabular"/>
  528. </tr>
  529. </xsl:for-each>
  530. </table>
  531. </xsl:template>
  532. <xsl:template match="funcdef" mode="ansi-tabular">
  533. <code>
  534. <xsl:apply-templates select="." mode="class.attribute"/>
  535. <xsl:apply-templates mode="ansi-tabular"/>
  536. <xsl:text>(</xsl:text>
  537. </code>
  538. </xsl:template>
  539. <xsl:template match="funcdef/function" mode="ansi-tabular">
  540. <xsl:choose>
  541. <xsl:when test="$funcsynopsis.decoration != 0">
  542. <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
  543. </xsl:when>
  544. <xsl:otherwise>
  545. <xsl:apply-templates mode="kr-tabular"/>
  546. </xsl:otherwise>
  547. </xsl:choose>
  548. </xsl:template>
  549. <xsl:template match="void" mode="ansi-tabular">
  550. <td>
  551. <code>void)</code>
  552. <xsl:text>;</xsl:text>
  553. </td>
  554. <td>&#160;</td>
  555. </xsl:template>
  556. <xsl:template match="varargs" mode="ansi-tabular">
  557. <td>
  558. <xsl:text>...</xsl:text>
  559. <code>)</code>
  560. <xsl:text>;</xsl:text>
  561. </td>
  562. <td>&#160;</td>
  563. </xsl:template>
  564. <xsl:template match="paramdef" mode="ansi-tabular">
  565. <xsl:variable name="type">
  566. <xsl:choose>
  567. <xsl:when test="type">
  568. <xsl:apply-templates select="type" mode="ansi-tabular"/>
  569. </xsl:when>
  570. <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
  571. <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
  572. </xsl:when>
  573. </xsl:choose>
  574. </xsl:variable>
  575. <xsl:choose>
  576. <xsl:when test="$type != '' and funcparams">
  577. <td>
  578. <xsl:copy-of select="$type"/>
  579. <xsl:text>&#160;</xsl:text>
  580. </td>
  581. <td>
  582. <xsl:choose>
  583. <xsl:when test="type">
  584. <xsl:apply-templates select="type/following-sibling::*" mode="ansi-tabular"/>
  585. </xsl:when>
  586. <xsl:otherwise>
  587. <xsl:apply-templates select="*" mode="ansi-tabular"/>
  588. </xsl:otherwise>
  589. </xsl:choose>
  590. <xsl:choose>
  591. <xsl:when test="following-sibling::*">
  592. <xsl:text>, </xsl:text>
  593. </xsl:when>
  594. <xsl:otherwise>
  595. <code>)</code>
  596. <xsl:text>;</xsl:text>
  597. </xsl:otherwise>
  598. </xsl:choose>
  599. </td>
  600. </xsl:when>
  601. <xsl:otherwise>
  602. <td>
  603. <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]" mode="ansi-tabular"/>
  604. <xsl:text>&#160;</xsl:text>
  605. </td>
  606. <td>
  607. <xsl:apply-templates select="parameter" mode="ansi-tabular"/>
  608. <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]" mode="ansi-tabular"/>
  609. <xsl:choose>
  610. <xsl:when test="following-sibling::*">
  611. <xsl:text>, </xsl:text>
  612. </xsl:when>
  613. <xsl:otherwise>
  614. <code>)</code>
  615. <xsl:text>;</xsl:text>
  616. </xsl:otherwise>
  617. </xsl:choose>
  618. </td>
  619. </xsl:otherwise>
  620. </xsl:choose>
  621. </xsl:template>
  622. <xsl:template match="paramdef/parameter" mode="ansi-tabular">
  623. <xsl:choose>
  624. <xsl:when test="$funcsynopsis.decoration != 0">
  625. <var class="pdparam">
  626. <xsl:apply-templates mode="ansi-tabular"/>
  627. </var>
  628. </xsl:when>
  629. <xsl:otherwise>
  630. <code>
  631. <xsl:apply-templates mode="ansi-tabular"/>
  632. </code>
  633. </xsl:otherwise>
  634. </xsl:choose>
  635. </xsl:template>
  636. <xsl:template match="funcparams" mode="ansi-tabular">
  637. <code>(</code>
  638. <xsl:apply-templates/>
  639. <code>)</code>
  640. </xsl:template>
  641. <!-- ====================================================================== -->
  642. <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
  643. <xsl:template match="classsynopsis |fieldsynopsis |methodsynopsis |constructorsynopsis |destructorsynopsis">
  644. <xsl:param name="language">
  645. <xsl:choose>
  646. <xsl:when test="@language">
  647. <xsl:value-of select="@language"/>
  648. </xsl:when>
  649. <xsl:otherwise>
  650. <xsl:value-of select="$default-classsynopsis-language"/>
  651. </xsl:otherwise>
  652. </xsl:choose>
  653. </xsl:param>
  654. <xsl:choose>
  655. <xsl:when test="$language='java' or $language='Java'">
  656. <xsl:apply-templates select="." mode="java"/>
  657. </xsl:when>
  658. <xsl:when test="$language='perl' or $language='Perl'">
  659. <xsl:apply-templates select="." mode="perl"/>
  660. </xsl:when>
  661. <xsl:when test="$language='idl' or $language='IDL'">
  662. <xsl:apply-templates select="." mode="idl"/>
  663. </xsl:when>
  664. <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
  665. <xsl:apply-templates select="." mode="cpp"/>
  666. </xsl:when>
  667. <xsl:otherwise>
  668. <xsl:message>
  669. <xsl:text>Unrecognized language on </xsl:text>
  670. <xsl:value-of select="local-name(.)"/>
  671. <xsl:text>: </xsl:text>
  672. <xsl:value-of select="$language"/>
  673. </xsl:message>
  674. <xsl:apply-templates select=".">
  675. <xsl:with-param name="language" select="$default-classsynopsis-language"/>
  676. </xsl:apply-templates>
  677. </xsl:otherwise>
  678. </xsl:choose>
  679. </xsl:template>
  680. <xsl:template name="synop-break">
  681. <xsl:if test="parent::classsynopsis or (following-sibling::fieldsynopsis |following-sibling::methodsynopsis |following-sibling::constructorsynopsis |following-sibling::destructorsynopsis)">
  682. <br/>
  683. </xsl:if>
  684. </xsl:template>
  685. <!-- ===== Java ======================================================== -->
  686. <xsl:template match="classsynopsis" mode="java">
  687. <pre>
  688. <xsl:apply-templates select="." mode="class.attribute"/>
  689. <xsl:apply-templates select="ooclass[1]" mode="java"/>
  690. <xsl:if test="ooclass[preceding-sibling::*]">
  691. <xsl:text> extends</xsl:text>
  692. <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
  693. <xsl:if test="oointerface|ooexception">
  694. <br/>
  695. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  696. </xsl:if>
  697. </xsl:if>
  698. <xsl:if test="oointerface">
  699. <xsl:text>implements</xsl:text>
  700. <xsl:apply-templates select="oointerface" mode="java"/>
  701. <xsl:if test="ooexception">
  702. <br/>
  703. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  704. </xsl:if>
  705. </xsl:if>
  706. <xsl:if test="ooexception">
  707. <xsl:text>throws</xsl:text>
  708. <xsl:apply-templates select="ooexception" mode="java"/>
  709. </xsl:if>
  710. <xsl:text>&#160;{</xsl:text>
  711. <br/>
  712. <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="java"/>
  713. <xsl:text>}</xsl:text>
  714. </pre>
  715. </xsl:template>
  716. <xsl:template match="classsynopsisinfo" mode="java">
  717. <xsl:apply-templates mode="java"/>
  718. </xsl:template>
  719. <xsl:template match="ooclass|oointerface|ooexception" mode="java">
  720. <xsl:choose>
  721. <xsl:when test="preceding-sibling::*">
  722. <xsl:text>, </xsl:text>
  723. </xsl:when>
  724. <xsl:otherwise>
  725. <xsl:text> </xsl:text>
  726. </xsl:otherwise>
  727. </xsl:choose>
  728. <span>
  729. <xsl:apply-templates select="." mode="class.attribute"/>
  730. <xsl:apply-templates mode="java"/>
  731. </span>
  732. </xsl:template>
  733. <xsl:template match="modifier|package" mode="java">
  734. <span>
  735. <xsl:apply-templates select="." mode="class.attribute"/>
  736. <xsl:apply-templates mode="java"/>
  737. <xsl:if test="following-sibling::*">
  738. <xsl:text>&#160;</xsl:text>
  739. </xsl:if>
  740. </span>
  741. </xsl:template>
  742. <xsl:template match="classname" mode="java">
  743. <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
  744. <xsl:text>, </xsl:text>
  745. </xsl:if>
  746. <span>
  747. <xsl:apply-templates select="." mode="class.attribute"/>
  748. <xsl:apply-templates mode="java"/>
  749. </span>
  750. </xsl:template>
  751. <xsl:template match="interfacename" mode="java">
  752. <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
  753. <xsl:text>, </xsl:text>
  754. </xsl:if>
  755. <span>
  756. <xsl:apply-templates select="." mode="class.attribute"/>
  757. <xsl:apply-templates mode="java"/>
  758. </span>
  759. </xsl:template>
  760. <xsl:template match="exceptionname" mode="java">
  761. <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
  762. <xsl:text>, </xsl:text>
  763. </xsl:if>
  764. <span>
  765. <xsl:apply-templates select="." mode="class.attribute"/>
  766. <xsl:apply-templates mode="java"/>
  767. </span>
  768. </xsl:template>
  769. <xsl:template match="fieldsynopsis" mode="java">
  770. <code>
  771. <xsl:apply-templates select="." mode="class.attribute"/>
  772. <xsl:if test="parent::classsynopsis">
  773. <xsl:text>&#160;&#160;</xsl:text>
  774. </xsl:if>
  775. <xsl:apply-templates mode="java"/>
  776. <xsl:text>;</xsl:text>
  777. </code>
  778. <xsl:call-template name="synop-break"/>
  779. </xsl:template>
  780. <xsl:template match="type" mode="java">
  781. <span>
  782. <xsl:apply-templates select="." mode="class.attribute"/>
  783. <xsl:apply-templates mode="java"/>
  784. <xsl:text>&#160;</xsl:text>
  785. </span>
  786. </xsl:template>
  787. <xsl:template match="varname" mode="java">
  788. <span>
  789. <xsl:apply-templates select="." mode="class.attribute"/>
  790. <xsl:apply-templates mode="java"/>
  791. <xsl:text>&#160;</xsl:text>
  792. </span>
  793. </xsl:template>
  794. <xsl:template match="initializer" mode="java">
  795. <span>
  796. <xsl:apply-templates select="." mode="class.attribute"/>
  797. <xsl:text>=&#160;</xsl:text>
  798. <xsl:apply-templates mode="java"/>
  799. </span>
  800. </xsl:template>
  801. <xsl:template match="void" mode="java">
  802. <span>
  803. <xsl:apply-templates select="." mode="class.attribute"/>
  804. <xsl:text>void&#160;</xsl:text>
  805. </span>
  806. </xsl:template>
  807. <xsl:template match="methodname" mode="java">
  808. <span>
  809. <xsl:apply-templates select="." mode="class.attribute"/>
  810. <xsl:apply-templates mode="java"/>
  811. </span>
  812. </xsl:template>
  813. <xsl:template match="methodparam" mode="java">
  814. <xsl:param name="indent">0</xsl:param>
  815. <xsl:if test="preceding-sibling::methodparam">
  816. <xsl:text>,</xsl:text>
  817. <br/>
  818. <xsl:if test="$indent &gt; 0">
  819. <xsl:call-template name="copy-string">
  820. <xsl:with-param name="string">&#160;</xsl:with-param>
  821. <xsl:with-param name="count" select="$indent + 1"/>
  822. </xsl:call-template>
  823. </xsl:if>
  824. </xsl:if>
  825. <span>
  826. <xsl:apply-templates select="." mode="class.attribute"/>
  827. <xsl:apply-templates mode="java"/>
  828. </span>
  829. </xsl:template>
  830. <xsl:template match="parameter" mode="java">
  831. <span>
  832. <xsl:apply-templates select="." mode="class.attribute"/>
  833. <xsl:apply-templates mode="java"/>
  834. </span>
  835. </xsl:template>
  836. <xsl:template mode="java" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  837. <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
  838. <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
  839. <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
  840. <xsl:variable name="decl">
  841. <xsl:if test="parent::classsynopsis">
  842. <xsl:text>&#160;&#160;</xsl:text>
  843. </xsl:if>
  844. <xsl:apply-templates select="$start-modifiers" mode="java"/>
  845. <!-- type -->
  846. <xsl:if test="local-name($notmod[1]) != 'methodname'">
  847. <xsl:apply-templates select="$notmod[1]" mode="java"/>
  848. </xsl:if>
  849. <xsl:apply-templates select="methodname" mode="java"/>
  850. </xsl:variable>
  851. <code>
  852. <xsl:apply-templates select="." mode="class.attribute"/>
  853. <xsl:copy-of select="$decl"/>
  854. <xsl:text>(</xsl:text>
  855. <xsl:apply-templates select="methodparam" mode="java">
  856. <xsl:with-param name="indent" select="string-length($decl)"/>
  857. </xsl:apply-templates>
  858. <xsl:text>)</xsl:text>
  859. <xsl:if test="exceptionname">
  860. <br/>
  861. <xsl:text>&#160;&#160;&#160;&#160;throws&#160;</xsl:text>
  862. <xsl:apply-templates select="exceptionname" mode="java"/>
  863. </xsl:if>
  864. <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
  865. <xsl:text> </xsl:text>
  866. <xsl:apply-templates select="$end-modifiers" mode="java"/>
  867. </xsl:if>
  868. <xsl:text>;</xsl:text>
  869. </code>
  870. <xsl:call-template name="synop-break"/>
  871. </xsl:template>
  872. <!-- ===== C++ ========================================================= -->
  873. <xsl:template match="classsynopsis" mode="cpp">
  874. <pre>
  875. <xsl:apply-templates select="." mode="class.attribute"/>
  876. <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
  877. <xsl:if test="ooclass[preceding-sibling::*]">
  878. <xsl:text>: </xsl:text>
  879. <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/>
  880. <xsl:if test="oointerface|ooexception">
  881. <br/>
  882. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  883. </xsl:if>
  884. </xsl:if>
  885. <xsl:if test="oointerface">
  886. <xsl:text> implements</xsl:text>
  887. <xsl:apply-templates select="oointerface" mode="cpp"/>
  888. <xsl:if test="ooexception">
  889. <br/>
  890. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  891. </xsl:if>
  892. </xsl:if>
  893. <xsl:if test="ooexception">
  894. <xsl:text> throws</xsl:text>
  895. <xsl:apply-templates select="ooexception" mode="cpp"/>
  896. </xsl:if>
  897. <xsl:text>&#160;{</xsl:text>
  898. <br/>
  899. <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="cpp"/>
  900. <xsl:text>}</xsl:text>
  901. </pre>
  902. </xsl:template>
  903. <xsl:template match="classsynopsisinfo" mode="cpp">
  904. <xsl:apply-templates mode="cpp"/>
  905. </xsl:template>
  906. <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
  907. <xsl:if test="preceding-sibling::*">
  908. <xsl:text>, </xsl:text>
  909. </xsl:if>
  910. <span>
  911. <xsl:apply-templates select="." mode="class.attribute"/>
  912. <xsl:apply-templates mode="cpp"/>
  913. </span>
  914. </xsl:template>
  915. <xsl:template match="modifier|package" mode="cpp">
  916. <span>
  917. <xsl:apply-templates select="." mode="class.attribute"/>
  918. <xsl:apply-templates mode="cpp"/>
  919. <xsl:if test="following-sibling::*">
  920. <xsl:text>&#160;</xsl:text>
  921. </xsl:if>
  922. </span>
  923. </xsl:template>
  924. <xsl:template match="classname" mode="cpp">
  925. <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
  926. <xsl:text>, </xsl:text>
  927. </xsl:if>
  928. <span>
  929. <xsl:apply-templates select="." mode="class.attribute"/>
  930. <xsl:apply-templates mode="cpp"/>
  931. </span>
  932. </xsl:template>
  933. <xsl:template match="interfacename" mode="cpp">
  934. <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
  935. <xsl:text>, </xsl:text>
  936. </xsl:if>
  937. <span>
  938. <xsl:apply-templates select="." mode="class.attribute"/>
  939. <xsl:apply-templates mode="cpp"/>
  940. </span>
  941. </xsl:template>
  942. <xsl:template match="exceptionname" mode="cpp">
  943. <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
  944. <xsl:text>, </xsl:text>
  945. </xsl:if>
  946. <span>
  947. <xsl:apply-templates select="." mode="class.attribute"/>
  948. <xsl:apply-templates mode="cpp"/>
  949. </span>
  950. </xsl:template>
  951. <xsl:template match="fieldsynopsis" mode="cpp">
  952. <code>
  953. <xsl:apply-templates select="." mode="class.attribute"/>
  954. <xsl:if test="parent::classsynopsis">
  955. <xsl:text>&#160;&#160;</xsl:text>
  956. </xsl:if>
  957. <xsl:apply-templates mode="cpp"/>
  958. <xsl:text>;</xsl:text>
  959. </code>
  960. <xsl:call-template name="synop-break"/>
  961. </xsl:template>
  962. <xsl:template match="type" mode="cpp">
  963. <span>
  964. <xsl:apply-templates select="." mode="class.attribute"/>
  965. <xsl:apply-templates mode="cpp"/>
  966. <xsl:text>&#160;</xsl:text>
  967. </span>
  968. </xsl:template>
  969. <xsl:template match="varname" mode="cpp">
  970. <span>
  971. <xsl:apply-templates select="." mode="class.attribute"/>
  972. <xsl:apply-templates mode="cpp"/>
  973. <xsl:text>&#160;</xsl:text>
  974. </span>
  975. </xsl:template>
  976. <xsl:template match="initializer" mode="cpp">
  977. <span>
  978. <xsl:apply-templates select="." mode="class.attribute"/>
  979. <xsl:text>=&#160;</xsl:text>
  980. <xsl:apply-templates mode="cpp"/>
  981. </span>
  982. </xsl:template>
  983. <xsl:template match="void" mode="cpp">
  984. <span>
  985. <xsl:apply-templates select="." mode="class.attribute"/>
  986. <xsl:text>void&#160;</xsl:text>
  987. </span>
  988. </xsl:template>
  989. <xsl:template match="methodname" mode="cpp">
  990. <span>
  991. <xsl:apply-templates select="." mode="class.attribute"/>
  992. <xsl:apply-templates mode="cpp"/>
  993. </span>
  994. </xsl:template>
  995. <xsl:template match="methodparam" mode="cpp">
  996. <xsl:if test="preceding-sibling::methodparam">
  997. <xsl:text>, </xsl:text>
  998. </xsl:if>
  999. <span>
  1000. <xsl:apply-templates select="." mode="class.attribute"/>
  1001. <xsl:apply-templates mode="cpp"/>
  1002. </span>
  1003. </xsl:template>
  1004. <xsl:template match="parameter" mode="cpp">
  1005. <span>
  1006. <xsl:apply-templates select="." mode="class.attribute"/>
  1007. <xsl:apply-templates mode="cpp"/>
  1008. </span>
  1009. </xsl:template>
  1010. <xsl:template mode="cpp" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  1011. <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
  1012. <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
  1013. <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
  1014. <code>
  1015. <xsl:apply-templates select="." mode="class.attribute"/>
  1016. <xsl:if test="parent::classsynopsis">
  1017. <xsl:text>&#160;&#160;</xsl:text>
  1018. </xsl:if>
  1019. <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
  1020. <!-- type -->
  1021. <xsl:if test="local-name($notmod[1]) != 'methodname'">
  1022. <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
  1023. </xsl:if>
  1024. <xsl:apply-templates select="methodname" mode="cpp"/>
  1025. <xsl:text>(</xsl:text>
  1026. <xsl:apply-templates select="methodparam" mode="cpp"/>
  1027. <xsl:text>)</xsl:text>
  1028. <xsl:if test="exceptionname">
  1029. <br/>
  1030. <xsl:text>&#160;&#160;&#160;&#160;throws&#160;</xsl:text>
  1031. <xsl:apply-templates select="exceptionname" mode="cpp"/>
  1032. </xsl:if>
  1033. <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
  1034. <xsl:text> </xsl:text>
  1035. <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
  1036. </xsl:if>
  1037. <xsl:text>;</xsl:text>
  1038. </code>
  1039. <xsl:call-template name="synop-break"/>
  1040. </xsl:template>
  1041. <!-- ===== IDL ========================================================= -->
  1042. <xsl:template match="classsynopsis" mode="idl">
  1043. <pre>
  1044. <xsl:apply-templates select="." mode="class.attribute"/>
  1045. <xsl:text>interface </xsl:text>
  1046. <xsl:apply-templates select="ooclass[1]" mode="idl"/>
  1047. <xsl:if test="ooclass[preceding-sibling::*]">
  1048. <xsl:text>: </xsl:text>
  1049. <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
  1050. <xsl:if test="oointerface|ooexception">
  1051. <br/>
  1052. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  1053. </xsl:if>
  1054. </xsl:if>
  1055. <xsl:if test="oointerface">
  1056. <xsl:text> implements</xsl:text>
  1057. <xsl:apply-templates select="oointerface" mode="idl"/>
  1058. <xsl:if test="ooexception">
  1059. <br/>
  1060. <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
  1061. </xsl:if>
  1062. </xsl:if>
  1063. <xsl:if test="ooexception">
  1064. <xsl:text> throws</xsl:text>
  1065. <xsl:apply-templates select="ooexception" mode="idl"/>
  1066. </xsl:if>
  1067. <xsl:text>&#160;{</xsl:text>
  1068. <br/>
  1069. <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="idl"/>
  1070. <xsl:text>}</xsl:text>
  1071. </pre>
  1072. </xsl:template>
  1073. <xsl:template match="classsynopsisinfo" mode="idl">
  1074. <xsl:apply-templates mode="idl"/>
  1075. </xsl:template>
  1076. <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
  1077. <xsl:if test="preceding-sibling::*">
  1078. <xsl:text>, </xsl:text>
  1079. </xsl:if>
  1080. <span>
  1081. <xsl:apply-templates select="." mode="class.attribute"/>
  1082. <xsl:apply-templates mode="idl"/>
  1083. </span>
  1084. </xsl:template>
  1085. <xsl:template match="modifier|package" mode="idl">
  1086. <span>
  1087. <xsl:apply-templates select="." mode="class.attribute"/>
  1088. <xsl:apply-templates mode="idl"/>
  1089. <xsl:if test="following-sibling::*">
  1090. <xsl:text>&#160;</xsl:text>
  1091. </xsl:if>
  1092. </span>
  1093. </xsl:template>
  1094. <xsl:template match="classname" mode="idl">
  1095. <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
  1096. <xsl:text>, </xsl:text>
  1097. </xsl:if>
  1098. <span>
  1099. <xsl:apply-templates select="." mode="class.attribute"/>
  1100. <xsl:apply-templates mode="idl"/>
  1101. </span>
  1102. </xsl:template>
  1103. <xsl:template match="interfacename" mode="idl">
  1104. <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
  1105. <xsl:text>, </xsl:text>
  1106. </xsl:if>
  1107. <span>
  1108. <xsl:apply-templates select="." mode="class.attribute"/>
  1109. <xsl:apply-templates mode="idl"/>
  1110. </span>
  1111. </xsl:template>
  1112. <xsl:template match="exceptionname" mode="idl">
  1113. <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
  1114. <xsl:text>, </xsl:text>
  1115. </xsl:if>
  1116. <span>
  1117. <xsl:apply-templates select="." mode="class.attribute"/>
  1118. <xsl:apply-templates mode="idl"/>
  1119. </span>
  1120. </xsl:template>
  1121. <xsl:template match="fieldsynopsis" mode="idl">
  1122. <code>
  1123. <xsl:apply-templates select="." mode="class.attribute"/>
  1124. <xsl:if test="parent::classsynopsis">
  1125. <xsl:text>&#160;&#160;</xsl:text>
  1126. </xsl:if>
  1127. <xsl:apply-templates mode="idl"/>
  1128. <xsl:text>;</xsl:text>
  1129. </code>
  1130. <xsl:call-template name="synop-break"/>
  1131. </xsl:template>
  1132. <xsl:template match="type" mode="idl">
  1133. <span>
  1134. <xsl:apply-templates select="." mode="class.attribute"/>
  1135. <xsl:apply-templates mode="idl"/>
  1136. <xsl:text>&#160;</xsl:text>
  1137. </span>
  1138. </xsl:template>
  1139. <xsl:template match="varname" mode="idl">
  1140. <span>
  1141. <xsl:apply-templates select="." mode="class.attribute"/>
  1142. <xsl:apply-templates mode="idl"/>
  1143. <xsl:text>&#160;</xsl:text>
  1144. </span>
  1145. </xsl:template>
  1146. <xsl:template match="initializer" mode="idl">
  1147. <span>
  1148. <xsl:apply-templates select="." mode="class.attribute"/>
  1149. <xsl:text>=&#160;</xsl:text>
  1150. <xsl:apply-templates mode="idl"/>
  1151. </span>
  1152. </xsl:template>
  1153. <xsl:template match="void" mode="idl">
  1154. <span>
  1155. <xsl:apply-templates select="." mode="class.attribute"/>
  1156. <xsl:text>void&#160;</xsl:text>
  1157. </span>
  1158. </xsl:template>
  1159. <xsl:template match="methodname" mode="idl">
  1160. <span>
  1161. <xsl:apply-templates select="." mode="class.attribute"/>
  1162. <xsl:apply-templates mode="idl"/>
  1163. </span>
  1164. </xsl:template>
  1165. <xsl:template match="methodparam" mode="idl">
  1166. <xsl:if test="preceding-sibling::methodparam">
  1167. <xsl:text>, </xsl:text>
  1168. </xsl:if>
  1169. <span>
  1170. <xsl:apply-templates select="." mode="class.attribute"/>
  1171. <xsl:apply-templates mode="idl"/>
  1172. </span>
  1173. </xsl:template>
  1174. <xsl:template match="parameter" mode="idl">
  1175. <span>
  1176. <xsl:apply-templates select="." mode="class.attribute"/>
  1177. <xsl:apply-templates mode="idl"/>
  1178. </span>
  1179. </xsl:template>
  1180. <xsl:template mode="idl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  1181. <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
  1182. <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
  1183. <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
  1184. <code>
  1185. <xsl:apply-templates select="." mode="class.attribute"/>
  1186. <xsl:if test="parent::classsynopsis">
  1187. <xsl:text>&#160;&#160;</xsl:text>
  1188. </xsl:if>
  1189. <xsl:apply-templates select="$start-modifiers" mode="idl"/>
  1190. <!-- type -->
  1191. <xsl:if test="local-name($notmod[1]) != 'methodname'">
  1192. <xsl:apply-templates select="$notmod[1]" mode="idl"/>
  1193. </xsl:if>
  1194. <xsl:apply-templates select="methodname" mode="idl"/>
  1195. <xsl:text>(</xsl:text>
  1196. <xsl:apply-templates select="methodparam" mode="idl"/>
  1197. <xsl:text>)</xsl:text>
  1198. <xsl:if test="exceptionname">
  1199. <br/>
  1200. <xsl:text>&#160;&#160;&#160;&#160;raises(</xsl:text>
  1201. <xsl:apply-templates select="exceptionname" mode="idl"/>
  1202. <xsl:text>)</xsl:text>
  1203. </xsl:if>
  1204. <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
  1205. <xsl:text> </xsl:text>
  1206. <xsl:apply-templates select="$end-modifiers" mode="idl"/>
  1207. </xsl:if>
  1208. <xsl:text>;</xsl:text>
  1209. </code>
  1210. <xsl:call-template name="synop-break"/>
  1211. </xsl:template>
  1212. <!-- ===== Perl ======================================================== -->
  1213. <xsl:template match="classsynopsis" mode="perl">
  1214. <pre>
  1215. <xsl:apply-templates select="." mode="class.attribute"/>
  1216. <xsl:text>package </xsl:text>
  1217. <xsl:apply-templates select="ooclass[1]" mode="perl"/>
  1218. <xsl:text>;</xsl:text>
  1219. <br/>
  1220. <xsl:if test="ooclass[preceding-sibling::*]">
  1221. <xsl:text>@ISA = (</xsl:text>
  1222. <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
  1223. <xsl:text>);</xsl:text>
  1224. <br/>
  1225. </xsl:if>
  1226. <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="perl"/>
  1227. </pre>
  1228. </xsl:template>
  1229. <xsl:template match="classsynopsisinfo" mode="perl">
  1230. <xsl:apply-templates mode="perl"/>
  1231. </xsl:template>
  1232. <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
  1233. <xsl:if test="preceding-sibling::*">
  1234. <xsl:text>, </xsl:text>
  1235. </xsl:if>
  1236. <span>
  1237. <xsl:apply-templates select="." mode="class.attribute"/>
  1238. <xsl:apply-templates mode="perl"/>
  1239. </span>
  1240. </xsl:template>
  1241. <xsl:template match="modifier|package" mode="perl">
  1242. <span>
  1243. <xsl:apply-templates select="." mode="class.attribute"/>
  1244. <xsl:apply-templates mode="perl"/>
  1245. <xsl:if test="following-sibling::*">
  1246. <xsl:text>&#160;</xsl:text>
  1247. </xsl:if>
  1248. </span>
  1249. </xsl:template>
  1250. <xsl:template match="classname" mode="perl">
  1251. <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
  1252. <xsl:text>, </xsl:text>
  1253. </xsl:if>
  1254. <span>
  1255. <xsl:apply-templates select="." mode="class.attribute"/>
  1256. <xsl:apply-templates mode="perl"/>
  1257. </span>
  1258. </xsl:template>
  1259. <xsl:template match="interfacename" mode="perl">
  1260. <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
  1261. <xsl:text>, </xsl:text>
  1262. </xsl:if>
  1263. <span>
  1264. <xsl:apply-templates select="." mode="class.attribute"/>
  1265. <xsl:apply-templates mode="perl"/>
  1266. </span>
  1267. </xsl:template>
  1268. <xsl:template match="exceptionname" mode="perl">
  1269. <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
  1270. <xsl:text>, </xsl:text>
  1271. </xsl:if>
  1272. <span>
  1273. <xsl:apply-templates select="." mode="class.attribute"/>
  1274. <xsl:apply-templates mode="perl"/>
  1275. </span>
  1276. </xsl:template>
  1277. <xsl:template match="fieldsynopsis" mode="perl">
  1278. <code>
  1279. <xsl:apply-templates select="." mode="class.attribute"/>
  1280. <xsl:if test="parent::classsynopsis">
  1281. <xsl:text>&#160;&#160;</xsl:text>
  1282. </xsl:if>
  1283. <xsl:apply-templates mode="perl"/>
  1284. <xsl:text>;</xsl:text>
  1285. </code>
  1286. <xsl:call-template name="synop-break"/>
  1287. </xsl:template>
  1288. <xsl:template match="type" mode="perl">
  1289. <span>
  1290. <xsl:apply-templates select="." mode="class.attribute"/>
  1291. <xsl:apply-templates mode="perl"/>
  1292. <xsl:text>&#160;</xsl:text>
  1293. </span>
  1294. </xsl:template>
  1295. <xsl:template match="varname" mode="perl">
  1296. <span>
  1297. <xsl:apply-templates select="." mode="class.attribute"/>
  1298. <xsl:apply-templates mode="perl"/>
  1299. <xsl:text>&#160;</xsl:text>
  1300. </span>
  1301. </xsl:template>
  1302. <xsl:template match="initializer" mode="perl">
  1303. <span>
  1304. <xsl:apply-templates select="." mode="class.attribute"/>
  1305. <xsl:text>=&#160;</xsl:text>
  1306. <xsl:apply-templates mode="perl"/>
  1307. </span>
  1308. </xsl:template>
  1309. <xsl:template match="void" mode="perl">
  1310. <span>
  1311. <xsl:apply-templates select="." mode="class.attribute"/>
  1312. <xsl:text>void&#160;</xsl:text>
  1313. </span>
  1314. </xsl:template>
  1315. <xsl:template match="methodname" mode="perl">
  1316. <span>
  1317. <xsl:apply-templates select="." mode="class.attribute"/>
  1318. <xsl:apply-templates mode="perl"/>
  1319. </span>
  1320. </xsl:template>
  1321. <xsl:template match="methodparam" mode="perl">
  1322. <xsl:if test="preceding-sibling::methodparam">
  1323. <xsl:text>, </xsl:text>
  1324. </xsl:if>
  1325. <span>
  1326. <xsl:apply-templates select="." mode="class.attribute"/>
  1327. <xsl:apply-templates mode="perl"/>
  1328. </span>
  1329. </xsl:template>
  1330. <xsl:template match="parameter" mode="perl">
  1331. <span>
  1332. <xsl:apply-templates select="." mode="class.attribute"/>
  1333. <xsl:apply-templates mode="perl"/>
  1334. </span>
  1335. </xsl:template>
  1336. <xsl:template mode="perl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  1337. <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
  1338. <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
  1339. <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
  1340. <code>
  1341. <xsl:apply-templates select="." mode="class.attribute"/>
  1342. <xsl:text>sub </xsl:text>
  1343. <xsl:apply-templates select="methodname" mode="perl"/>
  1344. <xsl:text> { ... };</xsl:text>
  1345. </code>
  1346. <xsl:call-template name="synop-break"/>
  1347. </xsl:template>
  1348. <!-- ==================================================================== -->
  1349. <!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
  1350. <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
  1351. <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
  1352. <!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
  1353. <!-- * per-mode matches for those linking elements in order for them -->
  1354. <!-- * to be processed as expected. -->
  1355. <xsl:template match="link|olink|xref" mode="java">
  1356. <xsl:apply-templates select="."/>
  1357. </xsl:template>
  1358. <xsl:template match="link|olink|xref" mode="cpp">
  1359. <xsl:apply-templates select="."/>
  1360. </xsl:template>
  1361. <xsl:template match="link|olink|xref" mode="idl">
  1362. <xsl:apply-templates select="."/>
  1363. </xsl:template>
  1364. <xsl:template match="link|olink|xref" mode="perl">
  1365. <xsl:apply-templates select="."/>
  1366. </xsl:template>
  1367. </xsl:stylesheet>