home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _DCF8E549741B48D1A374EE6DD1080C48 < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  31.0 KB  |  961 lines

  1. <?xml version="1.0" encoding="US-ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets. Do not edit this file.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  5.  
  6. <!-- ********************************************************************
  7.      $Id: synop.xsl,v 1.1.2.3 2002/09/04 13:55:51 jdj Exp $
  8.      ********************************************************************
  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.  
  16. <!-- ==================================================================== -->
  17.  
  18. <!-- synopsis is in verbatim -->
  19.  
  20. <!-- ==================================================================== -->
  21.  
  22. <xsl:template match="cmdsynopsis">
  23.   <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  24.     <p>
  25.       <xsl:call-template name="anchor"/>
  26.       <xsl:apply-templates/>
  27.     </p>
  28.   </div>
  29. </xsl:template>
  30.  
  31. <xsl:template match="cmdsynopsis/command">
  32.   <br xmlns="http://www.w3.org/1999/xhtml"/>
  33.   <xsl:call-template name="inline.monoseq"/>
  34.   <xsl:text> </xsl:text>
  35. </xsl:template>
  36.  
  37. <xsl:template match="cmdsynopsis/command[1]" priority="2">
  38.   <xsl:call-template name="inline.monoseq"/>
  39.   <xsl:text> </xsl:text>
  40. </xsl:template>
  41.  
  42. <xsl:template match="group|arg">
  43.   <xsl:variable name="choice" select="@choice"/>
  44.   <xsl:variable name="rep" select="@rep"/>
  45.   <xsl:variable name="sepchar">
  46.     <xsl:choose>
  47.       <xsl:when test="ancestor-or-self::*/@sepchar">
  48.         <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
  49.       </xsl:when>
  50.       <xsl:otherwise>
  51.         <xsl:text> </xsl:text>
  52.       </xsl:otherwise>
  53.     </xsl:choose>
  54.   </xsl:variable>
  55.   <xsl:if test="position()>1"><xsl:value-of select="$sepchar"/></xsl:if>
  56.   <xsl:choose>
  57.     <xsl:when test="$choice='plain'">
  58.       <xsl:value-of select="$arg.choice.plain.open.str"/>
  59.     </xsl:when>
  60.     <xsl:when test="$choice='req'">
  61.       <xsl:value-of select="$arg.choice.req.open.str"/>
  62.     </xsl:when>
  63.     <xsl:when test="$choice='opt'">
  64.       <xsl:value-of select="$arg.choice.opt.open.str"/>
  65.     </xsl:when>
  66.     <xsl:otherwise>
  67.       <xsl:value-of select="$arg.choice.def.open.str"/>
  68.     </xsl:otherwise>
  69.   </xsl:choose>
  70.   <xsl:apply-templates/>
  71.   <xsl:choose>
  72.     <xsl:when test="$rep='repeat'">
  73.       <xsl:value-of select="$arg.rep.repeat.str"/>
  74.     </xsl:when>
  75.     <xsl:when test="$rep='norepeat'">
  76.       <xsl:value-of select="$arg.rep.norepeat.str"/>
  77.     </xsl:when>
  78.     <xsl:otherwise>
  79.       <xsl:value-of select="$arg.rep.def.str"/>
  80.     </xsl:otherwise>
  81.   </xsl:choose>
  82.   <xsl:choose>
  83.     <xsl:when test="$choice='plain'">
  84.       <xsl:value-of select="$arg.choice.plain.close.str"/>
  85.     </xsl:when>
  86.     <xsl:when test="$choice='req'">
  87.       <xsl:value-of select="$arg.choice.req.close.str"/>
  88.     </xsl:when>
  89.     <xsl:when test="$choice='opt'">
  90.       <xsl:value-of select="$arg.choice.opt.close.str"/>
  91.     </xsl:when>
  92.     <xsl:otherwise>
  93.       <xsl:value-of select="$arg.choice.def.close.str"/>
  94.     </xsl:otherwise>
  95.   </xsl:choose>
  96. </xsl:template>
  97.  
  98. <xsl:template match="group/arg">
  99.   <xsl:variable name="choice" select="@choice"/>
  100.   <xsl:variable name="rep" select="@rep"/>
  101.   <xsl:if test="position()>1"><xsl:value-of select="$arg.or.sep"/></xsl:if>
  102.   <xsl:apply-templates/>
  103. </xsl:template>
  104.  
  105. <xsl:template match="sbr">
  106.   <br xmlns="http://www.w3.org/1999/xhtml"/>
  107. </xsl:template>
  108.  
  109. <!-- ==================================================================== -->
  110.  
  111. <xsl:template match="synopfragmentref">
  112.   <xsl:variable name="target" select="key('id',@linkend)"/>
  113.   <xsl:variable name="snum">
  114.     <xsl:apply-templates select="$target" mode="synopfragment.number"/>
  115.   </xsl:variable>
  116.   <i xmlns="http://www.w3.org/1999/xhtml">
  117.     <a href="#{@linkend}">
  118.       <xsl:text>(</xsl:text>
  119.       <xsl:value-of select="$snum"/>
  120.       <xsl:text>)</xsl:text>
  121.     </a>
  122.     <xsl:text> </xsl:text>
  123.     <xsl:apply-templates/>
  124.   </i>
  125. </xsl:template>
  126.  
  127. <xsl:template match="synopfragment" mode="synopfragment.number">
  128.   <xsl:number format="1"/>
  129. </xsl:template>
  130.  
  131. <xsl:template match="synopfragment">
  132.   <xsl:variable name="snum">
  133.     <xsl:apply-templates select="." mode="synopfragment.number"/>
  134.   </xsl:variable>
  135.   <p xmlns="http://www.w3.org/1999/xhtml">
  136.     <a id="#{@id}">
  137.       <xsl:text>(</xsl:text>
  138.       <xsl:value-of select="$snum"/>
  139.       <xsl:text>)</xsl:text>
  140.     </a>
  141.     <xsl:text> </xsl:text>
  142.     <xsl:apply-templates/>
  143.   </p>
  144. </xsl:template>   
  145.  
  146. <xsl:template match="funcsynopsis">
  147.   <xsl:call-template name="informal.object"/>
  148. </xsl:template>
  149.  
  150. <xsl:template match="funcsynopsisinfo">
  151.   <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}"><xsl:apply-templates/></pre>
  152. </xsl:template>
  153.  
  154. <xsl:template match="funcprototype">
  155.   <p xmlns="http://www.w3.org/1999/xhtml">
  156.     <code>
  157.       <xsl:apply-templates/>
  158.       <xsl:if test="$funcsynopsis.style='kr'">
  159.         <xsl:apply-templates select="./paramdef" mode="kr-funcsynopsis-mode"/>
  160.       </xsl:if>
  161.     </code>
  162.   </p>
  163. </xsl:template>
  164.  
  165. <xsl:template match="funcdef">
  166.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  167.     <xsl:apply-templates/>
  168.   </code>
  169. </xsl:template>
  170.  
  171. <xsl:template match="funcdef/function">
  172.   <xsl:choose>
  173.     <xsl:when test="$funcsynopsis.decoration != 0">
  174.       <b xmlns="http://www.w3.org/1999/xhtml" class="fsfunc"><xsl:apply-templates/></b>
  175.     </xsl:when>
  176.     <xsl:otherwise>
  177.       <xsl:apply-templates/>
  178.     </xsl:otherwise>
  179.   </xsl:choose>
  180. </xsl:template>
  181.  
  182. <xsl:template match="void">
  183.   <xsl:choose>
  184.     <xsl:when test="$funcsynopsis.style='ansi'">
  185.       <xsl:text>(void);</xsl:text>
  186.     </xsl:when>
  187.     <xsl:otherwise>
  188.       <xsl:text>();</xsl:text>
  189.     </xsl:otherwise>
  190.   </xsl:choose>
  191. </xsl:template>
  192.  
  193. <xsl:template match="varargs">
  194.   <xsl:text>(...);</xsl:text>
  195. </xsl:template>
  196.  
  197. <xsl:template match="paramdef">
  198.   <xsl:variable name="paramnum">
  199.     <xsl:number count="paramdef" format="1"/>
  200.   </xsl:variable>
  201.   <xsl:if test="$paramnum=1">(</xsl:if>
  202.   <xsl:choose>
  203.     <xsl:when test="$funcsynopsis.style='ansi'">
  204.       <xsl:apply-templates/>
  205.     </xsl:when>
  206.     <xsl:otherwise>
  207.       <xsl:apply-templates select="./parameter"/>
  208.     </xsl:otherwise>
  209.   </xsl:choose>
  210.   <xsl:choose>
  211.     <xsl:when test="following-sibling::paramdef">
  212.       <xsl:text>, </xsl:text>
  213.     </xsl:when>
  214.     <xsl:otherwise>
  215.       <xsl:text>);</xsl:text>
  216.     </xsl:otherwise>
  217.   </xsl:choose>
  218. </xsl:template>
  219.  
  220. <xsl:template match="paramdef/parameter">
  221.   <xsl:choose>
  222.     <xsl:when test="$funcsynopsis.decoration != 0">
  223.       <var xmlns="http://www.w3.org/1999/xhtml" class="pdparam">
  224.         <xsl:apply-templates/>
  225.       </var>
  226.     </xsl:when>
  227.     <xsl:otherwise>
  228.       <xsl:apply-templates/>
  229.     </xsl:otherwise>
  230.   </xsl:choose>
  231.   <xsl:if test="following-sibling::parameter">
  232.     <xsl:text>, </xsl:text>
  233.   </xsl:if>
  234. </xsl:template>
  235.  
  236. <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
  237.   <br xmlns="http://www.w3.org/1999/xhtml"/>
  238.   <xsl:apply-templates/>
  239.   <xsl:text>;</xsl:text>
  240. </xsl:template>
  241.  
  242. <xsl:template match="funcparams">
  243.   <xsl:text>(</xsl:text>
  244.   <xsl:apply-templates/>
  245.   <xsl:text>)</xsl:text>
  246. </xsl:template>
  247.  
  248. <!-- ==================================================================== -->
  249.  
  250. <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
  251.  
  252. <xsl:template match="classsynopsis                      |fieldsynopsis                      |methodsynopsis                      |constructorsynopsis                      |destructorsynopsis">
  253.   <xsl:param name="language">
  254.     <xsl:choose>
  255.       <xsl:when test="@language">
  256.     <xsl:value-of select="@language"/>
  257.       </xsl:when>
  258.       <xsl:otherwise>
  259.     <xsl:value-of select="$default-classsynopsis-language"/>
  260.       </xsl:otherwise>
  261.     </xsl:choose>
  262.   </xsl:param>
  263.  
  264.   <xsl:choose>
  265.     <xsl:when test="$language='java'">
  266.       <xsl:apply-templates select="." mode="java"/>
  267.     </xsl:when>
  268.     <xsl:when test="$language='perl'">
  269.       <xsl:apply-templates select="." mode="perl"/>
  270.     </xsl:when>
  271.     <xsl:when test="$language='idl'">
  272.       <xsl:apply-templates select="." mode="idl"/>
  273.     </xsl:when>
  274.     <xsl:when test="$language='cpp'">
  275.       <xsl:apply-templates select="." mode="cpp"/>
  276.     </xsl:when>
  277.     <xsl:otherwise>
  278.       <xsl:message>
  279.     <xsl:text>Unrecognized language on </xsl:text>
  280.         <xsl:value-of select="name(.)"/>
  281.         <xsl:text>: </xsl:text>
  282.     <xsl:value-of select="$language"/>
  283.       </xsl:message>
  284.       <xsl:apply-templates select=".">
  285.     <xsl:with-param name="language" select="$default-classsynopsis-language"/>
  286.       </xsl:apply-templates>
  287.     </xsl:otherwise>
  288.   </xsl:choose>
  289. </xsl:template>
  290.  
  291. <xsl:template name="synop-break">
  292.   <xsl:if test="parent::classsynopsis                 or (following-sibling::fieldsynopsis                     |following-sibling::methodsynopsis                     |following-sibling::constructorsynopsis                     |following-sibling::destructorsynopsis)">
  293.     <br xmlns="http://www.w3.org/1999/xhtml"/>
  294.   </xsl:if>
  295. </xsl:template>
  296.  
  297.  
  298. <!-- ===== Java ======================================================== -->
  299.  
  300. <xsl:template match="classsynopsis" mode="java">
  301.   <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  302.     <xsl:apply-templates select="ooclass[1]" mode="java"/>
  303.     <xsl:if test="ooclass[position() > 1]">
  304.       <xsl:text> extends</xsl:text>
  305.       <xsl:apply-templates select="ooclass[position() > 1]" mode="java"/>
  306.       <xsl:if test="oointerface|ooexception">
  307.         <br/>
  308.     <xsl:text>    </xsl:text>
  309.       </xsl:if>
  310.     </xsl:if>
  311.     <xsl:if test="oointerface">
  312.       <xsl:text>implements</xsl:text>
  313.       <xsl:apply-templates select="oointerface" mode="java"/>
  314.       <xsl:if test="ooexception">
  315.         <br/>
  316.     <xsl:text>    </xsl:text>
  317.       </xsl:if>
  318.     </xsl:if>
  319.     <xsl:if test="ooexception">
  320.       <xsl:text>throws</xsl:text>
  321.       <xsl:apply-templates select="ooexception" mode="java"/>
  322.     </xsl:if>
  323.     <xsl:text> {</xsl:text>
  324.     <br/>
  325.     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="java"/>
  326.     <xsl:text>}</xsl:text>
  327.   </pre>
  328. </xsl:template>
  329.  
  330. <xsl:template match="classsynopsisinfo" mode="java">
  331.   <xsl:apply-templates mode="java"/>
  332. </xsl:template>
  333.  
  334. <xsl:template match="ooclass|oointerface|ooexception" mode="java">
  335.   <xsl:choose>
  336.     <xsl:when test="position() > 1">
  337.       <xsl:text>, </xsl:text>
  338.     </xsl:when>
  339.     <xsl:otherwise>
  340.       <xsl:text> </xsl:text>
  341.     </xsl:otherwise>
  342.   </xsl:choose>
  343.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  344.     <xsl:apply-templates mode="java"/>
  345.   </span>
  346. </xsl:template>
  347.  
  348. <xsl:template match="modifier" mode="java">
  349.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  350.     <xsl:apply-templates mode="java"/>
  351.     <xsl:text> </xsl:text>
  352.   </span>
  353. </xsl:template>
  354.  
  355. <xsl:template match="classname" mode="java">
  356.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  357.     <xsl:text>, </xsl:text>
  358.   </xsl:if>
  359.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  360.     <xsl:apply-templates mode="java"/>
  361.   </span>
  362. </xsl:template>
  363.  
  364. <xsl:template match="interfacename" mode="java">
  365.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  366.     <xsl:text>, </xsl:text>
  367.   </xsl:if>
  368.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  369.     <xsl:apply-templates mode="java"/>
  370.   </span>
  371. </xsl:template>
  372.  
  373. <xsl:template match="exceptionname" mode="java">
  374.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  375.     <xsl:text>, </xsl:text>
  376.   </xsl:if>
  377.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  378.     <xsl:apply-templates mode="java"/>
  379.   </span>
  380. </xsl:template>
  381.  
  382. <xsl:template match="fieldsynopsis" mode="java">
  383.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  384.     <xsl:if test="parent::classsynopsis">
  385.       <xsl:text>  </xsl:text>
  386.     </xsl:if>
  387.     <xsl:apply-templates mode="java"/>
  388.     <xsl:text>;</xsl:text>
  389.   </code>
  390.   <xsl:call-template name="synop-break"/>
  391. </xsl:template>
  392.  
  393. <xsl:template match="type" mode="java">
  394.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  395.     <xsl:apply-templates mode="java"/>
  396.     <xsl:text> </xsl:text>
  397.   </span>
  398. </xsl:template>
  399.  
  400. <xsl:template match="varname" mode="java">
  401.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  402.     <xsl:apply-templates mode="java"/>
  403.     <xsl:text> </xsl:text>
  404.   </span>
  405. </xsl:template>
  406.  
  407. <xsl:template match="initializer" mode="java">
  408.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  409.     <xsl:text>= </xsl:text>
  410.     <xsl:apply-templates mode="java"/>
  411.   </span>
  412. </xsl:template>
  413.  
  414. <xsl:template match="void" mode="java">
  415.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  416.     <xsl:text>void </xsl:text>
  417.   </span>
  418. </xsl:template>
  419.  
  420. <xsl:template match="methodname" mode="java">
  421.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  422.     <xsl:apply-templates mode="java"/>
  423.   </span>
  424. </xsl:template>
  425.  
  426. <xsl:template match="methodparam" mode="java">
  427.   <xsl:param name="indent">0</xsl:param>
  428.   <xsl:if test="position() > 1">
  429.     <xsl:text>,</xsl:text>
  430.     <br xmlns="http://www.w3.org/1999/xhtml"/>
  431.     <xsl:if test="$indent > 0">
  432.       <xsl:call-template name="copy-string">
  433.     <xsl:with-param name="string"> </xsl:with-param>
  434.     <xsl:with-param name="count" select="$indent + 1"/>
  435.       </xsl:call-template>
  436.     </xsl:if>
  437.   </xsl:if>
  438.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  439.     <xsl:apply-templates mode="java"/>
  440.   </span>
  441. </xsl:template>
  442.  
  443. <xsl:template match="parameter" mode="java">
  444.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  445.     <xsl:apply-templates mode="java"/>
  446.   </span>
  447. </xsl:template>
  448.  
  449. <xsl:template mode="java" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  450.   <xsl:variable name="modifiers" select="modifier"/>
  451.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  452.   <xsl:variable name="decl">
  453.     <xsl:if test="parent::classsynopsis">
  454.       <xsl:text>  </xsl:text>
  455.     </xsl:if>
  456.     <xsl:apply-templates select="$modifiers" mode="java"/>
  457.  
  458.     <!-- type -->
  459.     <xsl:if test="name($notmod[1]) != 'methodname'">
  460.       <xsl:apply-templates select="$notmod[1]" mode="java"/>
  461.     </xsl:if>
  462.  
  463.     <xsl:apply-templates select="methodname" mode="java"/>
  464.   </xsl:variable>
  465.  
  466.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  467.     <xsl:copy-of select="$decl"/>
  468.     <xsl:text>(</xsl:text>
  469.     <xsl:apply-templates select="methodparam" mode="java">
  470.       <xsl:with-param name="indent" select="string-length($decl)"/>
  471.     </xsl:apply-templates>
  472.     <xsl:text>)</xsl:text>
  473.     <xsl:if test="exceptionname">
  474.       <br/>
  475.       <xsl:text>    throws </xsl:text>
  476.       <xsl:apply-templates select="exceptionname" mode="java"/>
  477.     </xsl:if>
  478.     <xsl:text>;</xsl:text>
  479.   </code>
  480.   <xsl:call-template name="synop-break"/>
  481. </xsl:template>
  482.  
  483. <!-- ===== C++ ========================================================= -->
  484.  
  485. <xsl:template match="classsynopsis" mode="cpp">
  486.   <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  487.     <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
  488.     <xsl:if test="ooclass[position() > 1]">
  489.       <xsl:text>: </xsl:text>
  490.       <xsl:apply-templates select="ooclass[position() > 1]" mode="cpp"/>
  491.       <xsl:if test="oointerface|ooexception">
  492.         <br/>
  493.     <xsl:text>    </xsl:text>
  494.       </xsl:if>
  495.     </xsl:if>
  496.     <xsl:if test="oointerface">
  497.       <xsl:text> implements</xsl:text>
  498.       <xsl:apply-templates select="oointerface" mode="cpp"/>
  499.       <xsl:if test="ooexception">
  500.         <br/>
  501.     <xsl:text>    </xsl:text>
  502.       </xsl:if>
  503.     </xsl:if>
  504.     <xsl:if test="ooexception">
  505.       <xsl:text> throws</xsl:text>
  506.       <xsl:apply-templates select="ooexception" mode="cpp"/>
  507.     </xsl:if>
  508.     <xsl:text> {</xsl:text>
  509.     <br/>
  510.     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="cpp"/>
  511.     <xsl:text>}</xsl:text>
  512.   </pre>
  513. </xsl:template>
  514.  
  515. <xsl:template match="classsynopsisinfo" mode="cpp">
  516.   <xsl:apply-templates mode="cpp"/>
  517. </xsl:template>
  518.  
  519. <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
  520.   <xsl:if test="position() > 1">
  521.     <xsl:text>, </xsl:text>
  522.   </xsl:if>
  523.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  524.     <xsl:apply-templates mode="cpp"/>
  525.   </span>
  526. </xsl:template>
  527.  
  528. <xsl:template match="modifier" mode="cpp">
  529.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  530.     <xsl:apply-templates mode="cpp"/>
  531.     <xsl:text> </xsl:text>
  532.   </span>
  533. </xsl:template>
  534.  
  535. <xsl:template match="classname" mode="cpp">
  536.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  537.     <xsl:text>, </xsl:text>
  538.   </xsl:if>
  539.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  540.     <xsl:apply-templates mode="cpp"/>
  541.   </span>
  542. </xsl:template>
  543.  
  544. <xsl:template match="interfacename" mode="cpp">
  545.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  546.     <xsl:text>, </xsl:text>
  547.   </xsl:if>
  548.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  549.     <xsl:apply-templates mode="cpp"/>
  550.   </span>
  551. </xsl:template>
  552.  
  553. <xsl:template match="exceptionname" mode="cpp">
  554.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  555.     <xsl:text>, </xsl:text>
  556.   </xsl:if>
  557.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  558.     <xsl:apply-templates mode="cpp"/>
  559.   </span>
  560. </xsl:template>
  561.  
  562. <xsl:template match="fieldsynopsis" mode="cpp">
  563.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  564.     <xsl:if test="parent::classsynopsis">
  565.       <xsl:text>  </xsl:text>
  566.     </xsl:if>
  567.     <xsl:apply-templates mode="cpp"/>
  568.     <xsl:text>;</xsl:text>
  569.   </code>
  570.   <xsl:call-template name="synop-break"/>
  571. </xsl:template>
  572.  
  573. <xsl:template match="type" mode="cpp">
  574.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  575.     <xsl:apply-templates mode="cpp"/>
  576.     <xsl:text> </xsl:text>
  577.   </span>
  578. </xsl:template>
  579.  
  580. <xsl:template match="varname" mode="cpp">
  581.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  582.     <xsl:apply-templates mode="cpp"/>
  583.     <xsl:text> </xsl:text>
  584.   </span>
  585. </xsl:template>
  586.  
  587. <xsl:template match="initializer" mode="cpp">
  588.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  589.     <xsl:text>= </xsl:text>
  590.     <xsl:apply-templates mode="cpp"/>
  591.   </span>
  592. </xsl:template>
  593.  
  594. <xsl:template match="void" mode="cpp">
  595.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  596.     <xsl:text>void </xsl:text>
  597.   </span>
  598. </xsl:template>
  599.  
  600. <xsl:template match="methodname" mode="cpp">
  601.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  602.     <xsl:apply-templates mode="cpp"/>
  603.   </span>
  604. </xsl:template>
  605.  
  606. <xsl:template match="methodparam" mode="cpp">
  607.   <xsl:if test="position() > 1">
  608.     <xsl:text>, </xsl:text>
  609.   </xsl:if>
  610.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  611.     <xsl:apply-templates mode="cpp"/>
  612.   </span>
  613. </xsl:template>
  614.  
  615. <xsl:template match="parameter" mode="cpp">
  616.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  617.     <xsl:apply-templates mode="cpp"/>
  618.   </span>
  619. </xsl:template>
  620.  
  621. <xsl:template mode="cpp" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  622.   <xsl:variable name="modifiers" select="modifier"/>
  623.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  624.  
  625.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  626.     <xsl:if test="parent::classsynopsis">
  627.       <xsl:text>  </xsl:text>
  628.     </xsl:if>
  629.     <xsl:apply-templates select="$modifiers" mode="cpp"/>
  630.  
  631.     <!-- type -->
  632.     <xsl:if test="name($notmod[1]) != 'methodname'">
  633.       <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
  634.     </xsl:if>
  635.  
  636.     <xsl:apply-templates select="methodname" mode="cpp"/>
  637.     <xsl:text>(</xsl:text>
  638.     <xsl:apply-templates select="methodparam" mode="cpp"/>
  639.     <xsl:text>)</xsl:text>
  640.     <xsl:if test="exceptionname">
  641.       <br/>
  642.       <xsl:text>    throws </xsl:text>
  643.       <xsl:apply-templates select="exceptionname" mode="cpp"/>
  644.     </xsl:if>
  645.     <xsl:text>;</xsl:text>
  646.   </code>
  647.   <xsl:call-template name="synop-break"/>
  648. </xsl:template>
  649.  
  650. <!-- ===== IDL ========================================================= -->
  651.  
  652. <xsl:template match="classsynopsis" mode="idl">
  653.   <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  654.     <xsl:text>interface </xsl:text>
  655.     <xsl:apply-templates select="ooclass[1]" mode="idl"/>
  656.     <xsl:if test="ooclass[position() > 1]">
  657.       <xsl:text>: </xsl:text>
  658.       <xsl:apply-templates select="ooclass[position() > 1]" mode="idl"/>
  659.       <xsl:if test="oointerface|ooexception">
  660.         <br/>
  661.     <xsl:text>    </xsl:text>
  662.       </xsl:if>
  663.     </xsl:if>
  664.     <xsl:if test="oointerface">
  665.       <xsl:text> implements</xsl:text>
  666.       <xsl:apply-templates select="oointerface" mode="idl"/>
  667.       <xsl:if test="ooexception">
  668.         <br/>
  669.     <xsl:text>    </xsl:text>
  670.       </xsl:if>
  671.     </xsl:if>
  672.     <xsl:if test="ooexception">
  673.       <xsl:text> throws</xsl:text>
  674.       <xsl:apply-templates select="ooexception" mode="idl"/>
  675.     </xsl:if>
  676.     <xsl:text> {</xsl:text>
  677.     <br/>
  678.     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="idl"/>
  679.     <xsl:text>}</xsl:text>
  680.   </pre>
  681. </xsl:template>
  682.  
  683. <xsl:template match="classsynopsisinfo" mode="idl">
  684.   <xsl:apply-templates mode="idl"/>
  685. </xsl:template>
  686.  
  687. <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
  688.   <xsl:if test="position() > 1">
  689.     <xsl:text>, </xsl:text>
  690.   </xsl:if>
  691.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  692.     <xsl:apply-templates mode="idl"/>
  693.   </span>
  694. </xsl:template>
  695.  
  696. <xsl:template match="modifier" mode="idl">
  697.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  698.     <xsl:apply-templates mode="idl"/>
  699.     <xsl:text> </xsl:text>
  700.   </span>
  701. </xsl:template>
  702.  
  703. <xsl:template match="classname" mode="idl">
  704.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  705.     <xsl:text>, </xsl:text>
  706.   </xsl:if>
  707.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  708.     <xsl:apply-templates mode="idl"/>
  709.   </span>
  710. </xsl:template>
  711.  
  712. <xsl:template match="interfacename" mode="idl">
  713.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  714.     <xsl:text>, </xsl:text>
  715.   </xsl:if>
  716.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  717.     <xsl:apply-templates mode="idl"/>
  718.   </span>
  719. </xsl:template>
  720.  
  721. <xsl:template match="exceptionname" mode="idl">
  722.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  723.     <xsl:text>, </xsl:text>
  724.   </xsl:if>
  725.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  726.     <xsl:apply-templates mode="idl"/>
  727.   </span>
  728. </xsl:template>
  729.  
  730. <xsl:template match="fieldsynopsis" mode="idl">
  731.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  732.     <xsl:if test="parent::classsynopsis">
  733.       <xsl:text>  </xsl:text>
  734.     </xsl:if>
  735.     <xsl:apply-templates mode="idl"/>
  736.     <xsl:text>;</xsl:text>
  737.   </code>
  738.   <xsl:call-template name="synop-break"/>
  739. </xsl:template>
  740.  
  741. <xsl:template match="type" mode="idl">
  742.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  743.     <xsl:apply-templates mode="idl"/>
  744.     <xsl:text> </xsl:text>
  745.   </span>
  746. </xsl:template>
  747.  
  748. <xsl:template match="varname" mode="idl">
  749.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  750.     <xsl:apply-templates mode="idl"/>
  751.     <xsl:text> </xsl:text>
  752.   </span>
  753. </xsl:template>
  754.  
  755. <xsl:template match="initializer" mode="idl">
  756.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  757.     <xsl:text>= </xsl:text>
  758.     <xsl:apply-templates mode="idl"/>
  759.   </span>
  760. </xsl:template>
  761.  
  762. <xsl:template match="void" mode="idl">
  763.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  764.     <xsl:text>void </xsl:text>
  765.   </span>
  766. </xsl:template>
  767.  
  768. <xsl:template match="methodname" mode="idl">
  769.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  770.     <xsl:apply-templates mode="idl"/>
  771.   </span>
  772. </xsl:template>
  773.  
  774. <xsl:template match="methodparam" mode="idl">
  775.   <xsl:if test="position() > 1">
  776.     <xsl:text>, </xsl:text>
  777.   </xsl:if>
  778.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  779.     <xsl:apply-templates mode="idl"/>
  780.   </span>
  781. </xsl:template>
  782.  
  783. <xsl:template match="parameter" mode="idl">
  784.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  785.     <xsl:apply-templates mode="idl"/>
  786.   </span>
  787. </xsl:template>
  788.  
  789. <xsl:template mode="idl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  790.   <xsl:variable name="modifiers" select="modifier"/>
  791.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  792.  
  793.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  794.     <xsl:if test="parent::classsynopsis">
  795.       <xsl:text>  </xsl:text>
  796.     </xsl:if>
  797.     <xsl:apply-templates select="$modifiers" mode="idl"/>
  798.  
  799.     <!-- type -->
  800.     <xsl:if test="name($notmod[1]) != 'methodname'">
  801.       <xsl:apply-templates select="$notmod[1]" mode="idl"/>
  802.     </xsl:if>
  803.  
  804.     <xsl:apply-templates select="methodname" mode="idl"/>
  805.     <xsl:text>(</xsl:text>
  806.     <xsl:apply-templates select="methodparam" mode="idl"/>
  807.     <xsl:text>)</xsl:text>
  808.     <xsl:if test="exceptionname">
  809.       <br/>
  810.       <xsl:text>    raises(</xsl:text>
  811.       <xsl:apply-templates select="exceptionname" mode="idl"/>
  812.       <xsl:text>)</xsl:text>
  813.     </xsl:if>
  814.     <xsl:text>;</xsl:text>
  815.   </code>
  816.   <xsl:call-template name="synop-break"/>
  817. </xsl:template>
  818.  
  819. <!-- ===== Perl ======================================================== -->
  820.  
  821. <xsl:template match="classsynopsis" mode="perl">
  822.   <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  823.     <xsl:text>package </xsl:text>
  824.     <xsl:apply-templates select="ooclass[1]" mode="perl"/>
  825.     <xsl:text>;</xsl:text>
  826.     <br/>
  827.  
  828.     <xsl:if test="ooclass[position() > 1]">
  829.       <xsl:text>@ISA = (</xsl:text>
  830.       <xsl:apply-templates select="ooclass[position() > 1]" mode="perl"/>
  831.       <xsl:text>);</xsl:text>
  832.       <br/>
  833.     </xsl:if>
  834.  
  835.     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="perl"/>
  836.   </pre>
  837. </xsl:template>
  838.  
  839. <xsl:template match="classsynopsisinfo" mode="perl">
  840.   <xsl:apply-templates mode="perl"/>
  841. </xsl:template>
  842.  
  843. <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
  844.   <xsl:if test="position() > 1">
  845.     <xsl:text>, </xsl:text>
  846.   </xsl:if>
  847.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  848.     <xsl:apply-templates mode="perl"/>
  849.   </span>
  850. </xsl:template>
  851.  
  852. <xsl:template match="modifier" mode="perl">
  853.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  854.     <xsl:apply-templates mode="perl"/>
  855.     <xsl:text> </xsl:text>
  856.   </span>
  857. </xsl:template>
  858.  
  859. <xsl:template match="classname" mode="perl">
  860.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  861.     <xsl:text>, </xsl:text>
  862.   </xsl:if>
  863.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  864.     <xsl:apply-templates mode="perl"/>
  865.   </span>
  866. </xsl:template>
  867.  
  868. <xsl:template match="interfacename" mode="perl">
  869.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  870.     <xsl:text>, </xsl:text>
  871.   </xsl:if>
  872.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  873.     <xsl:apply-templates mode="perl"/>
  874.   </span>
  875. </xsl:template>
  876.  
  877. <xsl:template match="exceptionname" mode="perl">
  878.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  879.     <xsl:text>, </xsl:text>
  880.   </xsl:if>
  881.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  882.     <xsl:apply-templates mode="perl"/>
  883.   </span>
  884. </xsl:template>
  885.  
  886. <xsl:template match="fieldsynopsis" mode="perl">
  887.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  888.     <xsl:if test="parent::classsynopsis">
  889.       <xsl:text>  </xsl:text>
  890.     </xsl:if>
  891.     <xsl:apply-templates mode="perl"/>
  892.     <xsl:text>;</xsl:text>
  893.   </code>
  894.   <xsl:call-template name="synop-break"/>
  895. </xsl:template>
  896.  
  897. <xsl:template match="type" mode="perl">
  898.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  899.     <xsl:apply-templates mode="perl"/>
  900.     <xsl:text> </xsl:text>
  901.   </span>
  902. </xsl:template>
  903.  
  904. <xsl:template match="varname" mode="perl">
  905.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  906.     <xsl:apply-templates mode="perl"/>
  907.     <xsl:text> </xsl:text>
  908.   </span>
  909. </xsl:template>
  910.  
  911. <xsl:template match="initializer" mode="perl">
  912.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  913.     <xsl:text>= </xsl:text>
  914.     <xsl:apply-templates mode="perl"/>
  915.   </span>
  916. </xsl:template>
  917.  
  918. <xsl:template match="void" mode="perl">
  919.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  920.     <xsl:text>void </xsl:text>
  921.   </span>
  922. </xsl:template>
  923.  
  924. <xsl:template match="methodname" mode="perl">
  925.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  926.     <xsl:apply-templates mode="perl"/>
  927.   </span>
  928. </xsl:template>
  929.  
  930. <xsl:template match="methodparam" mode="perl">
  931.   <xsl:if test="position() > 1">
  932.     <xsl:text>, </xsl:text>
  933.   </xsl:if>
  934.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  935.     <xsl:apply-templates mode="perl"/>
  936.   </span>
  937. </xsl:template>
  938.  
  939. <xsl:template match="parameter" mode="perl">
  940.   <span xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  941.     <xsl:apply-templates mode="perl"/>
  942.   </span>
  943. </xsl:template>
  944.  
  945. <xsl:template mode="perl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  946.   <xsl:variable name="modifiers" select="modifier"/>
  947.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  948.  
  949.   <code xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  950.     <xsl:text>sub </xsl:text>
  951.  
  952.     <xsl:apply-templates select="methodname" mode="perl"/>
  953.     <xsl:text> { ... };</xsl:text>
  954.   </code>
  955.   <xsl:call-template name="synop-break"/>
  956. </xsl:template>
  957.  
  958. <!-- ==================================================================== -->
  959.  
  960. </xsl:stylesheet>
  961.