synop.xsl 47 KB

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