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

  1. <?xml version='1.0'?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY RE " ">
  4. <!ENTITY nbsp " ">
  5. ]>
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7.                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
  8.                 version='1.0'>
  9.  
  10. <!-- ********************************************************************
  11.      $Id: synop.xsl,v 1.1.2.1 2002/09/04 14:25:42 jdj Exp $
  12.      ********************************************************************
  13.  
  14.      This file is part of the XSL DocBook Stylesheet distribution.
  15.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  16.      and other information.
  17.  
  18.      ******************************************************************** -->
  19.  
  20. <!-- ==================================================================== -->
  21.  
  22. <!-- synopsis is in verbatim -->
  23.  
  24. <!-- ==================================================================== -->
  25.  
  26. <xsl:template match="cmdsynopsis">
  27.   <fo:block>
  28.     <xsl:apply-templates/>
  29.   </fo:block>
  30. </xsl:template>
  31.  
  32. <xsl:template match="cmdsynopsis/command">
  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.   <fo:inline linefeed-treatment="preserve"> </fo:inline>
  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.   <fo:inline font-style="italic">
  117.     <fo:basic-link internal-destination="{@linkend}"
  118.                    xsl:use-attribute-sets="xref.properties">
  119.       <xsl:text>(</xsl:text>
  120.       <xsl:value-of select="$snum"/>
  121.       <xsl:text>)</xsl:text>
  122.     </fo:basic-link>
  123.     <xsl:text> </xsl:text>
  124.     <xsl:apply-templates/>
  125.   </fo:inline>
  126. </xsl:template>
  127.  
  128. <xsl:template match="synopfragment" mode="synopfragment.number">
  129.   <xsl:number format="1"/>
  130. </xsl:template>
  131.  
  132. <xsl:template match="synopfragment">
  133.   <xsl:variable name="snum">
  134.     <xsl:apply-templates select="." mode="synopfragment.number"/>
  135.   </xsl:variable>
  136.   <fo:block>
  137.     <xsl:text>(</xsl:text>
  138.     <xsl:value-of select="$snum"/>
  139.     <xsl:text>)</xsl:text>
  140.     <xsl:text> </xsl:text>
  141.     <xsl:apply-templates/>
  142.   </fo:block>
  143. </xsl:template>
  144.  
  145. <xsl:template match="funcsynopsis">
  146.   <xsl:call-template name="informal.object"/>
  147. </xsl:template>
  148.  
  149. <xsl:template match="funcsynopsisinfo">
  150.   <fo:block space-after.minimum="0.8em"
  151.             space-after.optimum="1em"
  152.             space-after.maximum="1.2em">
  153.     <xsl:apply-templates/>
  154.   </fo:block>
  155. </xsl:template>
  156.  
  157. <xsl:template match="funcprototype">
  158.   <fo:block font-family="{$monospace.font.family}">
  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.   </fo:block>
  164. </xsl:template>
  165.  
  166. <xsl:template match="funcdef">
  167.   <fo:inline font-family="{$monospace.font.family}">
  168.     <xsl:apply-templates/>
  169.   </fo:inline>
  170. </xsl:template>
  171.  
  172. <xsl:template match="funcdef/function">
  173.   <xsl:choose>
  174.     <xsl:when test="$funcsynopsis.decoration != 0">
  175.       <fo:inline font-weight="bold">
  176.         <xsl:apply-templates/>
  177.       </fo:inline>
  178.     </xsl:when>
  179.     <xsl:otherwise>
  180.       <xsl:apply-templates/>
  181.     </xsl:otherwise>
  182.   </xsl:choose>
  183. </xsl:template>
  184.  
  185. <xsl:template match="void">
  186.   <xsl:choose>
  187.     <xsl:when test="$funcsynopsis.style='ansi'">
  188.       <xsl:text>(void);</xsl:text>
  189.     </xsl:when>
  190.     <xsl:otherwise>
  191.       <xsl:text>();</xsl:text>
  192.     </xsl:otherwise>
  193.   </xsl:choose>
  194. </xsl:template>
  195.  
  196. <xsl:template match="varargs">
  197.   <xsl:text>(...);</xsl:text>
  198. </xsl:template>
  199.  
  200. <xsl:template match="paramdef">
  201.   <xsl:variable name="paramnum">
  202.     <xsl:number count="paramdef" format="1"/>
  203.   </xsl:variable>
  204.   <xsl:if test="$paramnum=1">(</xsl:if>
  205.   <xsl:choose>
  206.     <xsl:when test="$funcsynopsis.style='ansi'">
  207.       <xsl:apply-templates/>
  208.     </xsl:when>
  209.     <xsl:otherwise>
  210.       <xsl:apply-templates select="./parameter"/>
  211.     </xsl:otherwise>
  212.   </xsl:choose>
  213.   <xsl:choose>
  214.     <xsl:when test="following-sibling::paramdef">
  215.       <xsl:text>, </xsl:text>
  216.     </xsl:when>
  217.     <xsl:otherwise>
  218.       <xsl:text>);</xsl:text>
  219.     </xsl:otherwise>
  220.   </xsl:choose>
  221. </xsl:template>
  222.  
  223. <xsl:template match="paramdef/parameter">
  224.   <xsl:choose>
  225.     <xsl:when test="$funcsynopsis.decoration != 0">
  226.       <xsl:apply-templates/>
  227.     </xsl:when>
  228.     <xsl:otherwise>
  229.       <xsl:apply-templates/>
  230.     </xsl:otherwise>
  231.   </xsl:choose>
  232.   <xsl:if test="following-sibling::parameter">
  233.     <xsl:text>, </xsl:text>
  234.   </xsl:if>
  235. </xsl:template>
  236.  
  237. <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
  238.   <fo:block>
  239.     <xsl:apply-templates/>
  240.     <xsl:text>;</xsl:text>
  241.   </fo:block>
  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:message>process <xsl:value-of select="name(.)"/> in <xsl:value-of select="$language"/></xsl:message>
  271.  
  272.   <xsl:choose>
  273.     <xsl:when test="$language='java'">
  274.       <xsl:apply-templates select="." mode="java"/>
  275.     </xsl:when>
  276.     <xsl:when test="$language='perl'">
  277.       <xsl:apply-templates select="." mode="perl"/>
  278.     </xsl:when>
  279.     <xsl:when test="$language='idl'">
  280.       <xsl:apply-templates select="." mode="idl"/>
  281.     </xsl:when>
  282.     <xsl:when test="$language='cpp'">
  283.       <xsl:apply-templates select="." mode="cpp"/>
  284.     </xsl:when>
  285.     <xsl:otherwise>
  286.       <xsl:message>
  287.     <xsl:text>Unrecognized language on </xsl:text>
  288.         <xsl:value-of select="name(.)"/>
  289.         <xsl:text>: </xsl:text>
  290.     <xsl:value-of select="$language"/>
  291.       </xsl:message>
  292.       <xsl:apply-templates select=".">
  293.     <xsl:with-param name="language"
  294.       select="$default-classsynopsis-language"/>
  295.       </xsl:apply-templates>
  296.     </xsl:otherwise>
  297.   </xsl:choose>
  298. </xsl:template>
  299.  
  300. <xsl:template name="synop-break">
  301.   <xsl:if test="parent::classsynopsis
  302.                 or (following-sibling::fieldsynopsis
  303.                     |following-sibling::methodsynopsis
  304.                     |following-sibling::constructorsynopsis
  305.                     |following-sibling::destructorsynopsis)">
  306.     <fo:inline>&RE;</fo:inline>
  307.   </xsl:if>
  308. </xsl:template>
  309.  
  310. <!-- ===== Java ======================================================== -->
  311.  
  312. <xsl:template match="classsynopsis" mode="java">
  313.   <fo:block wrap-option='no-wrap'
  314.             white-space-collapse='false'
  315.             linefeed-treatment="preserve"
  316.             xsl:use-attribute-sets="monospace.verbatim.properties">
  317.     <xsl:apply-templates select="ooclass[1]" mode="java"/>
  318.     <xsl:if test="ooclass[position() > 1]">
  319.       <xsl:text> extends</xsl:text>
  320.       <xsl:apply-templates select="ooclass[position() > 1]" mode="java"/>
  321.       <xsl:if test="oointerface|ooexception">
  322.         <xsl:text>&RE;    </xsl:text>
  323.       </xsl:if>
  324.     </xsl:if>
  325.     <xsl:if test="oointerface">
  326.       <xsl:text>implements</xsl:text>
  327.       <xsl:apply-templates select="oointerface" mode="java"/>
  328.       <xsl:if test="ooexception">
  329.     <xsl:text>&RE;    </xsl:text>
  330.       </xsl:if>
  331.     </xsl:if>
  332.     <xsl:if test="ooexception">
  333.       <xsl:text>throws</xsl:text>
  334.       <xsl:apply-templates select="ooexception" mode="java"/>
  335.     </xsl:if>
  336.     <xsl:text> {&RE;</xsl:text>
  337.     <xsl:apply-templates select="constructorsynopsis
  338.                                  |destructorsynopsis
  339.                                  |fieldsynopsis
  340.                                  |methodsynopsis
  341.                                  |classsynopsisinfo" mode="java"/>
  342.     <xsl:text>}</xsl:text>
  343.   </fo:block>
  344. </xsl:template>
  345.  
  346. <xsl:template match="classsynopsisinfo" mode="java">
  347.   <xsl:apply-templates mode="java"/>
  348. </xsl:template>
  349.  
  350. <xsl:template match="ooclass|oointerface|ooexception" mode="java">
  351.   <xsl:choose>
  352.     <xsl:when test="position() > 1">
  353.       <xsl:text>, </xsl:text>
  354.     </xsl:when>
  355.     <xsl:otherwise>
  356.       <xsl:text> </xsl:text>
  357.     </xsl:otherwise>
  358.   </xsl:choose>
  359.   <xsl:apply-templates mode="java"/>
  360. </xsl:template>
  361.  
  362. <xsl:template match="modifier" mode="java">
  363.   <xsl:apply-templates mode="java"/>
  364.   <xsl:text> </xsl:text>
  365. </xsl:template>
  366.  
  367. <xsl:template match="classname" mode="java">
  368.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  369.     <xsl:text>, </xsl:text>
  370.   </xsl:if>
  371.   <xsl:apply-templates mode="java"/>
  372. </xsl:template>
  373.  
  374. <xsl:template match="interfacename" mode="java">
  375.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  376.     <xsl:text>, </xsl:text>
  377.   </xsl:if>
  378.   <xsl:apply-templates mode="java"/>
  379. </xsl:template>
  380.  
  381. <xsl:template match="exceptionname" mode="java">
  382.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  383.     <xsl:text>, </xsl:text>
  384.   </xsl:if>
  385.   <xsl:apply-templates mode="java"/>
  386. </xsl:template>
  387.  
  388. <xsl:template match="fieldsynopsis" mode="java">
  389.   <fo:block wrap-option='no-wrap'
  390.             white-space-collapse='false'
  391.             linefeed-treatment="preserve"
  392.             xsl:use-attribute-sets="monospace.verbatim.properties">
  393.     <xsl:text>  </xsl:text>
  394.     <xsl:apply-templates mode="java"/>
  395.     <xsl:text>;</xsl:text>
  396.     <xsl:call-template name="synop-break"/>
  397.   </fo:block>
  398. </xsl:template>
  399.  
  400. <xsl:template match="type" mode="java">
  401.   <xsl:apply-templates mode="java"/>
  402.   <xsl:text> </xsl:text>
  403. </xsl:template>
  404.  
  405. <xsl:template match="varname" mode="java">
  406.   <xsl:apply-templates mode="java"/>
  407.   <xsl:text> </xsl:text>
  408. </xsl:template>
  409.  
  410. <xsl:template match="initializer" mode="java">
  411.   <xsl:text>= </xsl:text>
  412.   <xsl:apply-templates mode="java"/>
  413. </xsl:template>
  414.  
  415. <xsl:template match="void" mode="java">
  416.   <xsl:text>void </xsl:text>
  417. </xsl:template>
  418.  
  419. <xsl:template match="methodname" mode="java">
  420.   <xsl:apply-templates mode="java"/>
  421. </xsl:template>
  422.  
  423. <xsl:template match="methodparam" mode="java">
  424.   <xsl:param name="indent">0</xsl:param>
  425.   <xsl:if test="position() > 1">
  426.     <xsl:text>,&RE;</xsl:text>
  427.     <xsl:if test="$indent > 0">
  428.       <xsl:call-template name="copy-string">
  429.     <xsl:with-param name="string"> </xsl:with-param>
  430.     <xsl:with-param name="count" select="$indent + 1"/>
  431.       </xsl:call-template>
  432.     </xsl:if>
  433.   </xsl:if>
  434.   <xsl:apply-templates mode="java"/>
  435. </xsl:template>
  436.  
  437. <xsl:template match="parameter" mode="java">
  438.   <xsl:apply-templates mode="java"/>
  439. </xsl:template>
  440.  
  441. <xsl:template mode="java"
  442.   match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  443.   <xsl:variable name="modifiers" select="modifier"/>
  444.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  445.   <xsl:variable name="decl">
  446.     <xsl:text>  </xsl:text>
  447.     <xsl:apply-templates select="$modifiers" mode="java"/>
  448.  
  449.     <!-- type -->
  450.     <xsl:if test="name($notmod[1]) != 'methodname'">
  451.       <xsl:apply-templates select="$notmod[1]" mode="java"/>
  452.     </xsl:if>
  453.  
  454.     <xsl:apply-templates select="methodname" mode="java"/>
  455.   </xsl:variable>
  456.  
  457.   <fo:block wrap-option='no-wrap'
  458.             white-space-collapse='false'
  459.             linefeed-treatment="preserve"
  460.             xsl:use-attribute-sets="monospace.verbatim.properties">
  461.     <xsl:copy-of select="$decl"/>
  462.     <xsl:text>(</xsl:text>
  463.     <xsl:apply-templates select="methodparam" mode="java">
  464.       <xsl:with-param name="indent" select="string-length($decl)"/>
  465.     </xsl:apply-templates>
  466.     <xsl:text>)</xsl:text>
  467.     <xsl:if test="exceptionname">
  468.       <xsl:text>&RE;    throws </xsl:text>
  469.       <xsl:apply-templates select="exceptionname" mode="java"/>
  470.     </xsl:if>
  471.     <xsl:text>;</xsl:text>
  472.   </fo:block>
  473.   <xsl:call-template name="synop-break"/>
  474. </xsl:template>
  475.  
  476. <!-- ===== C++ ========================================================= -->
  477.  
  478. <xsl:template match="classsynopsis" mode="cpp">
  479.   <fo:block wrap-option='no-wrap'
  480.             white-space-collapse='false'
  481.             linefeed-treatment="preserve"
  482.             xsl:use-attribute-sets="monospace.verbatim.properties">
  483.     <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
  484.     <xsl:if test="ooclass[position() > 1]">
  485.       <xsl:text>: </xsl:text>
  486.       <xsl:apply-templates select="ooclass[position() > 1]" mode="cpp"/>
  487.       <xsl:if test="oointerface|ooexception">
  488.     <xsl:text>&RE;    </xsl:text>
  489.       </xsl:if>
  490.     </xsl:if>
  491.     <xsl:if test="oointerface">
  492.       <xsl:text> implements</xsl:text>
  493.       <xsl:apply-templates select="oointerface" mode="cpp"/>
  494.       <xsl:if test="ooexception">
  495.     <xsl:text>&RE;    </xsl:text>
  496.       </xsl:if>
  497.     </xsl:if>
  498.     <xsl:if test="ooexception">
  499.       <xsl:text> throws</xsl:text>
  500.       <xsl:apply-templates select="ooexception" mode="cpp"/>
  501.     </xsl:if>
  502.     <xsl:text> {&RE;</xsl:text>
  503.     <xsl:apply-templates select="constructorsynopsis
  504.                                  |destructorsynopsis
  505.                                  |fieldsynopsis
  506.                                  |methodsynopsis
  507.                                  |classsynopsisinfo" mode="cpp"/>
  508.     <xsl:text>}</xsl:text>
  509.   </fo:block>
  510. </xsl:template>
  511.  
  512. <xsl:template match="classsynopsisinfo" mode="cpp">
  513.   <xsl:apply-templates mode="cpp"/>
  514. </xsl:template>
  515.  
  516. <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
  517.   <xsl:if test="position() > 1">
  518.     <xsl:text>, </xsl:text>
  519.   </xsl:if>
  520.   <xsl:apply-templates mode="cpp"/>
  521. </xsl:template>
  522.  
  523. <xsl:template match="modifier" mode="cpp">
  524.   <xsl:apply-templates mode="cpp"/>
  525.   <xsl:text> </xsl:text>
  526. </xsl:template>
  527.  
  528. <xsl:template match="classname" mode="cpp">
  529.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  530.     <xsl:text>, </xsl:text>
  531.   </xsl:if>
  532.   <xsl:apply-templates mode="cpp"/>
  533. </xsl:template>
  534.  
  535. <xsl:template match="interfacename" mode="cpp">
  536.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  537.     <xsl:text>, </xsl:text>
  538.   </xsl:if>
  539.   <xsl:apply-templates mode="cpp"/>
  540. </xsl:template>
  541.  
  542. <xsl:template match="exceptionname" mode="cpp">
  543.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  544.     <xsl:text>, </xsl:text>
  545.   </xsl:if>
  546.   <xsl:apply-templates mode="cpp"/>
  547. </xsl:template>
  548.  
  549. <xsl:template match="fieldsynopsis" mode="cpp">
  550.   <fo:block wrap-option='no-wrap'
  551.             white-space-collapse='false'
  552.             linefeed-treatment="preserve"
  553.             xsl:use-attribute-sets="monospace.verbatim.properties">
  554.     <xsl:text>  </xsl:text>
  555.     <xsl:apply-templates mode="cpp"/>
  556.     <xsl:text>;</xsl:text>
  557.   </fo:block>
  558.   <xsl:call-template name="synop-break"/>
  559. </xsl:template>
  560.  
  561. <xsl:template match="type" mode="cpp">
  562.   <xsl:apply-templates mode="cpp"/>
  563.   <xsl:text> </xsl:text>
  564. </xsl:template>
  565.  
  566. <xsl:template match="varname" mode="cpp">
  567.   <xsl:apply-templates mode="cpp"/>
  568.   <xsl:text> </xsl:text>
  569. </xsl:template>
  570.  
  571. <xsl:template match="initializer" mode="cpp">
  572.   <xsl:text>= </xsl:text>
  573.   <xsl:apply-templates mode="cpp"/>
  574. </xsl:template>
  575.  
  576. <xsl:template match="void" mode="cpp">
  577.   <xsl:text>void </xsl:text>
  578. </xsl:template>
  579.  
  580. <xsl:template match="methodname" mode="cpp">
  581.   <xsl:apply-templates mode="cpp"/>
  582. </xsl:template>
  583.  
  584. <xsl:template match="methodparam" mode="cpp">
  585.   <xsl:if test="position() > 1">
  586.     <xsl:text>, </xsl:text>
  587.   </xsl:if>
  588.   <xsl:apply-templates mode="cpp"/>
  589. </xsl:template>
  590.  
  591. <xsl:template match="parameter" mode="cpp">
  592.   <xsl:apply-templates mode="cpp"/>
  593. </xsl:template>
  594.  
  595. <xsl:template mode="cpp"
  596.   match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  597.   <xsl:variable name="modifiers" select="modifier"/>
  598.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  599.  
  600.   <fo:block wrap-option='no-wrap'
  601.             white-space-collapse='false'
  602.             linefeed-treatment="preserve"
  603.             xsl:use-attribute-sets="monospace.verbatim.properties">
  604.     <xsl:text>  </xsl:text>
  605.     <xsl:apply-templates select="$modifiers" mode="cpp"/>
  606.  
  607.     <!-- type -->
  608.     <xsl:if test="name($notmod[1]) != 'methodname'">
  609.       <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
  610.     </xsl:if>
  611.  
  612.     <xsl:apply-templates select="methodname" mode="cpp"/>
  613.     <xsl:text>(</xsl:text>
  614.     <xsl:apply-templates select="methodparam" mode="cpp"/>
  615.     <xsl:text>)</xsl:text>
  616.     <xsl:if test="exceptionname">
  617.       <xsl:text>&RE;    throws </xsl:text>
  618.       <xsl:apply-templates select="exceptionname" mode="cpp"/>
  619.     </xsl:if>
  620.     <xsl:text>;</xsl:text>
  621.   </fo:block>
  622.   <xsl:call-template name="synop-break"/>
  623. </xsl:template>
  624.  
  625. <!-- ===== IDL ========================================================= -->
  626.  
  627. <xsl:template match="classsynopsis" mode="idl">
  628.   <fo:block wrap-option='no-wrap'
  629.             white-space-collapse='false'
  630.             linefeed-treatment="preserve"
  631.             xsl:use-attribute-sets="monospace.verbatim.properties">
  632.     <xsl:text>interface </xsl:text>
  633.     <xsl:apply-templates select="ooclass[1]" mode="idl"/>
  634.     <xsl:if test="ooclass[position() > 1]">
  635.       <xsl:text>: </xsl:text>
  636.       <xsl:apply-templates select="ooclass[position() > 1]" mode="idl"/>
  637.       <xsl:if test="oointerface|ooexception">
  638.     <xsl:text>&RE;    </xsl:text>
  639.       </xsl:if>
  640.     </xsl:if>
  641.     <xsl:if test="oointerface">
  642.       <xsl:text> implements</xsl:text>
  643.       <xsl:apply-templates select="oointerface" mode="idl"/>
  644.       <xsl:if test="ooexception">
  645.     <xsl:text>&RE;    </xsl:text>
  646.       </xsl:if>
  647.     </xsl:if>
  648.     <xsl:if test="ooexception">
  649.       <xsl:text> throws</xsl:text>
  650.       <xsl:apply-templates select="ooexception" mode="idl"/>
  651.     </xsl:if>
  652.     <xsl:text> {&RE;</xsl:text>
  653.     <xsl:apply-templates select="constructorsynopsis
  654.                                  |destructorsynopsis
  655.                                  |fieldsynopsis
  656.                                  |methodsynopsis
  657.                                  |classsynopsisinfo" mode="idl"/>
  658.     <xsl:text>}</xsl:text>
  659.   </fo:block>
  660. </xsl:template>
  661.  
  662. <xsl:template match="classsynopsisinfo" mode="idl">
  663.   <xsl:apply-templates mode="idl"/>
  664. </xsl:template>
  665.  
  666. <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
  667.   <xsl:if test="position() > 1">
  668.     <xsl:text>, </xsl:text>
  669.   </xsl:if>
  670.   <xsl:apply-templates mode="idl"/>
  671. </xsl:template>
  672.  
  673. <xsl:template match="modifier" mode="idl">
  674.   <xsl:apply-templates mode="idl"/>
  675.   <xsl:text> </xsl:text>
  676. </xsl:template>
  677.  
  678. <xsl:template match="classname" mode="idl">
  679.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  680.     <xsl:text>, </xsl:text>
  681.   </xsl:if>
  682.   <xsl:apply-templates mode="idl"/>
  683. </xsl:template>
  684.  
  685. <xsl:template match="interfacename" mode="idl">
  686.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  687.     <xsl:text>, </xsl:text>
  688.   </xsl:if>
  689.   <xsl:apply-templates mode="idl"/>
  690. </xsl:template>
  691.  
  692. <xsl:template match="exceptionname" mode="idl">
  693.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  694.     <xsl:text>, </xsl:text>
  695.   </xsl:if>
  696.   <xsl:apply-templates mode="idl"/>
  697. </xsl:template>
  698.  
  699. <xsl:template match="fieldsynopsis" mode="idl">
  700.   <fo:block wrap-option='no-wrap'
  701.             white-space-collapse='false'
  702.             linefeed-treatment="preserve"
  703.             xsl:use-attribute-sets="monospace.verbatim.properties">
  704.     <xsl:text>  </xsl:text>
  705.     <xsl:apply-templates mode="idl"/>
  706.     <xsl:text>;</xsl:text>
  707.   </fo:block>
  708.   <xsl:call-template name="synop-break"/>
  709. </xsl:template>
  710.  
  711. <xsl:template match="type" mode="idl">
  712.   <xsl:apply-templates mode="idl"/>
  713.   <xsl:text> </xsl:text>
  714. </xsl:template>
  715.  
  716. <xsl:template match="varname" mode="idl">
  717.   <xsl:apply-templates mode="idl"/>
  718.   <xsl:text> </xsl:text>
  719. </xsl:template>
  720.  
  721. <xsl:template match="initializer" mode="idl">
  722.   <xsl:text>= </xsl:text>
  723.   <xsl:apply-templates mode="idl"/>
  724. </xsl:template>
  725.  
  726. <xsl:template match="void" mode="idl">
  727.   <xsl:text>void </xsl:text>
  728. </xsl:template>
  729.  
  730. <xsl:template match="methodname" mode="idl">
  731.   <xsl:apply-templates mode="idl"/>
  732. </xsl:template>
  733.  
  734. <xsl:template match="methodparam" mode="idl">
  735.   <xsl:if test="position() > 1">
  736.     <xsl:text>, </xsl:text>
  737.   </xsl:if>
  738.   <xsl:apply-templates mode="idl"/>
  739. </xsl:template>
  740.  
  741. <xsl:template match="parameter" mode="idl">
  742.   <xsl:apply-templates mode="idl"/>
  743. </xsl:template>
  744.  
  745. <xsl:template mode="idl"
  746.   match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  747.   <xsl:variable name="modifiers" select="modifier"/>
  748.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  749.  
  750.   <fo:block wrap-option='no-wrap'
  751.             white-space-collapse='false'
  752.             linefeed-treatment="preserve"
  753.             xsl:use-attribute-sets="monospace.verbatim.properties">
  754.     <xsl:text>  </xsl:text>
  755.     <xsl:apply-templates select="$modifiers" mode="idl"/>
  756.  
  757.     <!-- type -->
  758.     <xsl:if test="name($notmod[1]) != 'methodname'">
  759.       <xsl:apply-templates select="$notmod[1]" mode="idl"/>
  760.     </xsl:if>
  761.  
  762.     <xsl:apply-templates select="methodname" mode="idl"/>
  763.     <xsl:text>(</xsl:text>
  764.     <xsl:apply-templates select="methodparam" mode="idl"/>
  765.     <xsl:text>)</xsl:text>
  766.     <xsl:if test="exceptionname">
  767.       <xsl:text>&RE;    raises(</xsl:text>
  768.       <xsl:apply-templates select="exceptionname" mode="idl"/>
  769.       <xsl:text>)</xsl:text>
  770.     </xsl:if>
  771.     <xsl:text>;</xsl:text>
  772.   </fo:block>
  773.   <xsl:call-template name="synop-break"/>
  774. </xsl:template>
  775.  
  776. <!-- ===== Perl ======================================================== -->
  777.  
  778. <xsl:template match="classsynopsis" mode="perl">
  779.   <fo:block wrap-option='no-wrap'
  780.             white-space-collapse='false'
  781.             linefeed-treatment="preserve"
  782.             xsl:use-attribute-sets="monospace.verbatim.properties">
  783.     <xsl:text>package </xsl:text>
  784.     <xsl:apply-templates select="ooclass[1]" mode="perl"/>
  785.     <xsl:text>;&RE;</xsl:text>
  786.  
  787.     <xsl:if test="ooclass[position() > 1]">
  788.       <xsl:text>@ISA = (</xsl:text>
  789.       <xsl:apply-templates select="ooclass[position() > 1]" mode="perl"/>
  790.       <xsl:text>);&RE;</xsl:text>
  791.     </xsl:if>
  792.  
  793.     <xsl:apply-templates select="constructorsynopsis
  794.                                  |destructorsynopsis
  795.                                  |fieldsynopsis
  796.                                  |methodsynopsis
  797.                                  |classsynopsisinfo" mode="perl"/>
  798.   </fo:block>
  799. </xsl:template>
  800.  
  801. <xsl:template match="classsynopsisinfo" mode="perl">
  802.   <xsl:apply-templates mode="perl"/>
  803. </xsl:template>
  804.  
  805. <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
  806.   <xsl:if test="position() > 1">
  807.     <xsl:text>, </xsl:text>
  808.   </xsl:if>
  809.   <xsl:apply-templates mode="perl"/>
  810. </xsl:template>
  811.  
  812. <xsl:template match="modifier" mode="perl">
  813.   <xsl:apply-templates mode="perl"/>
  814.   <xsl:text> </xsl:text>
  815. </xsl:template>
  816.  
  817. <xsl:template match="classname" mode="perl">
  818.   <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
  819.     <xsl:text>, </xsl:text>
  820.   </xsl:if>
  821.   <xsl:apply-templates mode="perl"/>
  822. </xsl:template>
  823.  
  824. <xsl:template match="interfacename" mode="perl">
  825.   <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
  826.     <xsl:text>, </xsl:text>
  827.   </xsl:if>
  828.   <xsl:apply-templates mode="perl"/>
  829. </xsl:template>
  830.  
  831. <xsl:template match="exceptionname" mode="perl">
  832.   <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
  833.     <xsl:text>, </xsl:text>
  834.   </xsl:if>
  835.   <xsl:apply-templates mode="perl"/>
  836. </xsl:template>
  837.  
  838. <xsl:template match="fieldsynopsis" mode="perl">
  839.   <fo:block wrap-option='no-wrap'
  840.             white-space-collapse='false'
  841.             linefeed-treatment="preserve"
  842.             xsl:use-attribute-sets="monospace.verbatim.properties">
  843.     <xsl:text>  </xsl:text>
  844.     <xsl:apply-templates mode="perl"/>
  845.     <xsl:text>;</xsl:text>
  846.   </fo:block>
  847.   <xsl:call-template name="synop-break"/>
  848. </xsl:template>
  849.  
  850. <xsl:template match="type" mode="perl">
  851.   <xsl:apply-templates mode="perl"/>
  852.   <xsl:text> </xsl:text>
  853. </xsl:template>
  854.  
  855. <xsl:template match="varname" mode="perl">
  856.   <xsl:apply-templates mode="perl"/>
  857.   <xsl:text> </xsl:text>
  858. </xsl:template>
  859.  
  860. <xsl:template match="initializer" mode="perl">
  861.   <xsl:text>= </xsl:text>
  862.   <xsl:apply-templates mode="perl"/>
  863. </xsl:template>
  864.  
  865. <xsl:template match="void" mode="perl">
  866.   <xsl:text>void </xsl:text>
  867. </xsl:template>
  868.  
  869. <xsl:template match="methodname" mode="perl">
  870.   <xsl:apply-templates mode="perl"/>
  871. </xsl:template>
  872.  
  873. <xsl:template match="methodparam" mode="perl">
  874.   <xsl:if test="position() > 1">
  875.     <xsl:text>, </xsl:text>
  876.   </xsl:if>
  877.   <xsl:apply-templates mode="perl"/>
  878. </xsl:template>
  879.  
  880. <xsl:template match="parameter" mode="perl">
  881.   <xsl:apply-templates mode="perl"/>
  882. </xsl:template>
  883.  
  884. <xsl:template mode="perl"
  885.   match="constructorsynopsis|destructorsynopsis|methodsynopsis">
  886.   <xsl:variable name="modifiers" select="modifier"/>
  887.   <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
  888.  
  889.   <fo:block wrap-option='no-wrap'
  890.             white-space-collapse='false'
  891.             linefeed-treatment="preserve"
  892.             xsl:use-attribute-sets="monospace.verbatim.properties">
  893.     <xsl:text>sub </xsl:text>
  894.  
  895.     <xsl:apply-templates select="methodname" mode="perl"/>
  896.     <xsl:text> { ... };</xsl:text>
  897.     <xsl:call-template name="synop-break"/>
  898.   </fo:block>
  899. </xsl:template>
  900.  
  901. <!-- ==================================================================== -->
  902.  
  903. </xsl:stylesheet>
  904.