html-synop.xsl 51 KB

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