]> granicus.if.org Git - docbook-dsssl/commitdiff
Support classsynopsis and friends
authorNorman Walsh <ndw@nwalsh.com>
Fri, 15 Mar 2002 13:51:58 +0000 (13:51 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 15 Mar 2002 13:51:58 +0000 (13:51 +0000)
xsl/fo/synop.xsl
xsl/fo/verbatim.xsl

index 1872c67f05ee49291dca8ac79b78fd23bd759f42..f315b43496be8bb42b429ecdce517a9cd230ef00 100644 (file)
@@ -1,4 +1,8 @@
 <?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY RE "&#10;">
+<!ENTITY nbsp "&#160;">
+]>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
                 version='1.0'>
 
 <!-- ==================================================================== -->
 
-<xsl:template match="synopsis">
-  <fo:block>
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
+<!-- synopsis is in verbatim -->
 
 <!-- ==================================================================== -->
 
 
 <!-- ==================================================================== -->
 
+<xsl:variable name="default-classsynopsis-language">java</xsl:variable>
+
+<xsl:template match="classsynopsis
+                     |fieldsynopsis
+                     |methodsynopsis
+                     |constructorsynopsis
+                     |destructorsynopsis">
+  <xsl:param name="language">
+    <xsl:choose>
+      <xsl:when test="@language">
+       <xsl:value-of select="@language"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:value-of select="$default-classsynopsis-language"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:param>
+
+  <xsl:message>process <xsl:value-of select="name(.)"/> in <xsl:value-of select="$language"/></xsl:message>
+
+  <xsl:choose>
+    <xsl:when test="$language='java'">
+      <xsl:apply-templates select="." mode="java"/>
+    </xsl:when>
+    <xsl:when test="$language='perl'">
+      <xsl:apply-templates select="." mode="perl"/>
+    </xsl:when>
+    <xsl:when test="$language='idl'">
+      <xsl:apply-templates select="." mode="idl"/>
+    </xsl:when>
+    <xsl:when test="$language='cpp'">
+      <xsl:apply-templates select="." mode="cpp"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+       <xsl:text>Unrecognized language on </xsl:text>
+        <xsl:value-of select="name(.)"/>
+        <xsl:text>: </xsl:text>
+       <xsl:value-of select="$language"/>
+      </xsl:message>
+      <xsl:apply-templates select=".">
+       <xsl:with-param name="language"
+         select="$default-classsynopsis-language"/>
+      </xsl:apply-templates>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="synop-break">
+  <xsl:if test="parent::classsynopsis
+                or (following-sibling::fieldsynopsis
+                    |following-sibling::methodsynopsis
+                    |following-sibling::constructorsynopsis
+                    |following-sibling::destructorsynopsis)">
+    <fo:inline>&RE;</fo:inline>
+  </xsl:if>
+</xsl:template>
+
+<!-- ===== Java ======================================================== -->
+
+<xsl:template match="classsynopsis" mode="java">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:apply-templates select="ooclass[1]" mode="java"/>
+    <xsl:if test="ooclass[position() &gt; 1]">
+      <xsl:text> extends</xsl:text>
+      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="java"/>
+      <xsl:if test="oointerface|ooexception">
+        <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="oointerface">
+      <xsl:text>implements</xsl:text>
+      <xsl:apply-templates select="oointerface" mode="java"/>
+      <xsl:if test="ooexception">
+       <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="ooexception">
+      <xsl:text>throws</xsl:text>
+      <xsl:apply-templates select="ooexception" mode="java"/>
+    </xsl:if>
+    <xsl:text>&nbsp;{&RE;</xsl:text>
+    <xsl:apply-templates select="constructorsynopsis
+                                 |destructorsynopsis
+                                 |fieldsynopsis
+                                 |methodsynopsis
+                                 |classsynopsisinfo" mode="java"/>
+    <xsl:text>}</xsl:text>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="classsynopsisinfo" mode="java">
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="ooclass|oointerface|ooexception" mode="java">
+  <xsl:choose>
+    <xsl:when test="position() &gt; 1">
+      <xsl:text>, </xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text> </xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="modifier" mode="java">
+  <xsl:apply-templates mode="java"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="classname" mode="java">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="interfacename" mode="java">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="exceptionname" mode="java">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="fieldsynopsis" mode="java">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>&nbsp;&nbsp;</xsl:text>
+    <xsl:apply-templates mode="java"/>
+    <xsl:text>;</xsl:text>
+    <xsl:call-template name="synop-break"/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="type" mode="java">
+  <xsl:apply-templates mode="java"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="varname" mode="java">
+  <xsl:apply-templates mode="java"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="initializer" mode="java">
+  <xsl:text>=&nbsp;</xsl:text>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="void" mode="java">
+  <xsl:text>void&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="methodname" mode="java">
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="methodparam" mode="java">
+  <xsl:param name="indent">0</xsl:param>
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>,&RE;</xsl:text>
+    <xsl:if test="$indent &gt; 0">
+      <xsl:call-template name="copy-string">
+       <xsl:with-param name="string">&nbsp;</xsl:with-param>
+       <xsl:with-param name="count" select="$indent + 1"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:if>
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template match="parameter" mode="java">
+  <xsl:apply-templates mode="java"/>
+</xsl:template>
+
+<xsl:template mode="java"
+  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
+  <xsl:variable name="modifiers" select="modifier"/>
+  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
+  <xsl:variable name="decl">
+    <xsl:text>  </xsl:text>
+    <xsl:apply-templates select="$modifiers" mode="java"/>
+
+    <!-- type -->
+    <xsl:if test="name($notmod[1]) != 'methodname'">
+      <xsl:apply-templates select="$notmod[1]" mode="java"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="methodname" mode="java"/>
+  </xsl:variable>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:copy-of select="$decl"/>
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="methodparam" mode="java">
+      <xsl:with-param name="indent" select="string-length($decl)"/>
+    </xsl:apply-templates>
+    <xsl:text>)</xsl:text>
+    <xsl:if test="exceptionname">
+      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
+      <xsl:apply-templates select="exceptionname" mode="java"/>
+    </xsl:if>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<!-- ===== C++ ========================================================= -->
+
+<xsl:template match="classsynopsis" mode="cpp">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
+    <xsl:if test="ooclass[position() &gt; 1]">
+      <xsl:text>: </xsl:text>
+      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="cpp"/>
+      <xsl:if test="oointerface|ooexception">
+       <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="oointerface">
+      <xsl:text> implements</xsl:text>
+      <xsl:apply-templates select="oointerface" mode="cpp"/>
+      <xsl:if test="ooexception">
+       <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="ooexception">
+      <xsl:text> throws</xsl:text>
+      <xsl:apply-templates select="ooexception" mode="cpp"/>
+    </xsl:if>
+    <xsl:text>&nbsp;{&RE;</xsl:text>
+    <xsl:apply-templates select="constructorsynopsis
+                                 |destructorsynopsis
+                                 |fieldsynopsis
+                                 |methodsynopsis
+                                 |classsynopsisinfo" mode="cpp"/>
+    <xsl:text>}</xsl:text>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="classsynopsisinfo" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="modifier" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="classname" mode="cpp">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="interfacename" mode="cpp">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="exceptionname" mode="cpp">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="fieldsynopsis" mode="cpp">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>&nbsp;&nbsp;</xsl:text>
+    <xsl:apply-templates mode="cpp"/>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<xsl:template match="type" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="varname" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="initializer" mode="cpp">
+  <xsl:text>=&nbsp;</xsl:text>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="void" mode="cpp">
+  <xsl:text>void&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="methodname" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="methodparam" mode="cpp">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template match="parameter" mode="cpp">
+  <xsl:apply-templates mode="cpp"/>
+</xsl:template>
+
+<xsl:template mode="cpp"
+  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
+  <xsl:variable name="modifiers" select="modifier"/>
+  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>  </xsl:text>
+    <xsl:apply-templates select="$modifiers" mode="cpp"/>
+
+    <!-- type -->
+    <xsl:if test="name($notmod[1]) != 'methodname'">
+      <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="methodname" mode="cpp"/>
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="methodparam" mode="cpp"/>
+    <xsl:text>)</xsl:text>
+    <xsl:if test="exceptionname">
+      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
+      <xsl:apply-templates select="exceptionname" mode="cpp"/>
+    </xsl:if>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<!-- ===== IDL ========================================================= -->
+
+<xsl:template match="classsynopsis" mode="idl">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>interface </xsl:text>
+    <xsl:apply-templates select="ooclass[1]" mode="idl"/>
+    <xsl:if test="ooclass[position() &gt; 1]">
+      <xsl:text>: </xsl:text>
+      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="idl"/>
+      <xsl:if test="oointerface|ooexception">
+       <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="oointerface">
+      <xsl:text> implements</xsl:text>
+      <xsl:apply-templates select="oointerface" mode="idl"/>
+      <xsl:if test="ooexception">
+       <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="ooexception">
+      <xsl:text> throws</xsl:text>
+      <xsl:apply-templates select="ooexception" mode="idl"/>
+    </xsl:if>
+    <xsl:text>&nbsp;{&RE;</xsl:text>
+    <xsl:apply-templates select="constructorsynopsis
+                                 |destructorsynopsis
+                                 |fieldsynopsis
+                                 |methodsynopsis
+                                 |classsynopsisinfo" mode="idl"/>
+    <xsl:text>}</xsl:text>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="classsynopsisinfo" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="ooclass|oointerface|ooexception" mode="idl">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="modifier" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="classname" mode="idl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="interfacename" mode="idl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="exceptionname" mode="idl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="fieldsynopsis" mode="idl">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>&nbsp;&nbsp;</xsl:text>
+    <xsl:apply-templates mode="idl"/>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<xsl:template match="type" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="varname" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="initializer" mode="idl">
+  <xsl:text>=&nbsp;</xsl:text>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="void" mode="idl">
+  <xsl:text>void&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="methodname" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="methodparam" mode="idl">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template match="parameter" mode="idl">
+  <xsl:apply-templates mode="idl"/>
+</xsl:template>
+
+<xsl:template mode="idl"
+  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
+  <xsl:variable name="modifiers" select="modifier"/>
+  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>  </xsl:text>
+    <xsl:apply-templates select="$modifiers" mode="idl"/>
+
+    <!-- type -->
+    <xsl:if test="name($notmod[1]) != 'methodname'">
+      <xsl:apply-templates select="$notmod[1]" mode="idl"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="methodname" mode="idl"/>
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates select="methodparam" mode="idl"/>
+    <xsl:text>)</xsl:text>
+    <xsl:if test="exceptionname">
+      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;raises(</xsl:text>
+      <xsl:apply-templates select="exceptionname" mode="idl"/>
+      <xsl:text>)</xsl:text>
+    </xsl:if>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<!-- ===== Perl ======================================================== -->
+
+<xsl:template match="classsynopsis" mode="perl">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>package </xsl:text>
+    <xsl:apply-templates select="ooclass[1]" mode="perl"/>
+    <xsl:text>;&RE;</xsl:text>
+
+    <xsl:if test="ooclass[position() &gt; 1]">
+      <xsl:text>@ISA = (</xsl:text>
+      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="perl"/>
+      <xsl:text>);&RE;</xsl:text>
+    </xsl:if>
+
+    <xsl:apply-templates select="constructorsynopsis
+                                 |destructorsynopsis
+                                 |fieldsynopsis
+                                 |methodsynopsis
+                                 |classsynopsisinfo" mode="perl"/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="classsynopsisinfo" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="ooclass|oointerface|ooexception" mode="perl">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="modifier" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="classname" mode="perl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="interfacename" mode="perl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="exceptionname" mode="perl">
+  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="fieldsynopsis" mode="perl">
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>&nbsp;&nbsp;</xsl:text>
+    <xsl:apply-templates mode="perl"/>
+    <xsl:text>;</xsl:text>
+  </fo:block>
+  <xsl:call-template name="synop-break"/>
+</xsl:template>
+
+<xsl:template match="type" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="varname" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+  <xsl:text>&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="initializer" mode="perl">
+  <xsl:text>=&nbsp;</xsl:text>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="void" mode="perl">
+  <xsl:text>void&nbsp;</xsl:text>
+</xsl:template>
+
+<xsl:template match="methodname" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="methodparam" mode="perl">
+  <xsl:if test="position() &gt; 1">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template match="parameter" mode="perl">
+  <xsl:apply-templates mode="perl"/>
+</xsl:template>
+
+<xsl:template mode="perl"
+  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
+  <xsl:variable name="modifiers" select="modifier"/>
+  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:text>sub </xsl:text>
+
+    <xsl:apply-templates select="methodname" mode="perl"/>
+    <xsl:text> { ... };</xsl:text>
+    <xsl:call-template name="synop-break"/>
+  </fo:block>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
 </xsl:stylesheet>
index 94905f05f27f3bbd030bbf6726851a0e36262d8d..b7e6c222cb1815cdd011c67479546c0598e0588f 100644 (file)
@@ -20,7 +20,7 @@
 <lxslt:component prefix="xverb"
                  functions="numberLines"/>
 
-<xsl:template match="programlisting|screen">
+<xsl:template match="programlisting|screen|synopsis">
   <xsl:param name="suppress-numbers" select="'0'"/>
   <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>