synop.xsl 50 KB

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