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

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