synop.xsl 39 KB

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