]> granicus.if.org Git - docbook-dsssl/commitdiff
Another patch from Joe Orton
authorNorman Walsh <ndw@nwalsh.com>
Tue, 17 Sep 2002 20:22:01 +0000 (20:22 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Tue, 17 Sep 2002 20:22:01 +0000 (20:22 +0000)
xsl/manpages/db2man.xsl

index 7e776537a4c678dd97bde22f1120d44af67a2639..b7cf77af91ef53fe3923672211ab2aab7807f023 100644 (file)
   <xsl:variable name="section" select="refmeta/manvolnum"/>
   <xsl:variable name="name" select="refnamediv/refname[1]"/>
 
+  <!-- standard man page width is 64 chars; 6 chars needed for the two
+       (x) volume numbers, and 2 spaces, leaves 56 -->
+  <xsl:variable name="twidth" select="(56 - string-length(refmeta/refentrytitle)) div 2"/>
+
+  <xsl:variable name="reftitle" 
+               select="substring(refmeta/refentrytitle, 1, $twidth)"/>
+
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/title">
+        <xsl:value-of select="refentryinfo/title"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/title">
+        <xsl:value-of select="../referenceinfo/title"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="date">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/date">
+        <xsl:value-of select="refentryinfo/date"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/date">
+        <xsl:value-of select="../referenceinfo/date"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="productname">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/productname">
+        <xsl:value-of select="refentryinfo/productname"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/productname">
+        <xsl:value-of select="../referenceinfo/productname"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:call-template name="write.text.chunk">
     <xsl:with-param name="filename"
                    select="concat(normalize-space ($name), '.', $section)"/>
 .IP "\\$1" \\$2
 ..
 .TH "</xsl:text>
-      <xsl:value-of select="translate(refmeta/refentrytitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
       <xsl:text>" </xsl:text>
       <xsl:value-of select="refmeta/manvolnum[1]"/>
       <xsl:text> "</xsl:text>
-      <xsl:value-of select="refentryinfo/date"/>
+      <xsl:value-of select="normalize-space($date)"/>
       <xsl:text>" "</xsl:text>
-      <xsl:value-of select="refentryinfo/productname"/>
+      <xsl:value-of select="normalize-space($productname)"/>
       <xsl:text>" "</xsl:text>
-      <xsl:value-of select="refentryinfo/title"/>
+      <xsl:value-of select="$title"/>
       <xsl:text>"
 </xsl:text>
       <xsl:apply-templates/>