synop.xsl 51 KB

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