synop.xsl 46 KB

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