]> granicus.if.org Git - docbook-dsssl/commitdiff
Use titlepage templates for glossdiv formatting; support glossentry.show.acronyms
authorNorman Walsh <ndw@nwalsh.com>
Mon, 20 Jan 2003 17:06:11 +0000 (17:06 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 20 Jan 2003 17:06:11 +0000 (17:06 +0000)
xsl/fo/glossary.xsl

index 8ed184bf136bb5b5ff3207ef1a1a4d3bedc037b5..b881436b9e2b89907e8f10a427d3277b17d59705 100644 (file)
   </fo:block>
 </xsl:template>
 
+<xsl:template match="glossdiv/title"/>
+<xsl:template match="glossdiv/subtitle"/>
+<xsl:template match="glossdiv/titleabbrev"/>
+
+<!-- ==================================================================== -->
+
 <xsl:template name="make-glossary">
   <xsl:param name="divs" select="glossdiv"/>
   <xsl:param name="entries" select="glossentry"/>
 <xsl:template match="glossary/subtitle"></xsl:template>
 <xsl:template match="glossary/titleabbrev"></xsl:template>
 
-<xsl:template match="glossary/title" mode="component.title.mode">
-  <fo:block xsl:use-attribute-sets="component.title.properties">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-<xsl:template match="glossary/subtitle" mode="component.title.mode">
-  <fo:block font-size="18pt" font-weight="bold" font-style="italic">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
 <!-- ==================================================================== -->
 
 <xsl:template match="glosslist">
   </xsl:choose>
 </xsl:template>
 
-<!-- ==================================================================== -->
-
-<xsl:template match="glossdiv/title">
-  <fo:block font-size="16pt" font-weight="bold">
-    <xsl:apply-templates/>
-  </fo:block>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="glossentry" mode="xref">
-  <xsl:apply-templates select="./glossterm[1]" mode="xref"/>
-</xsl:template>
-
-<xsl:template match="glossterm" mode="xref">
-  <xsl:variable name="id">
-    <xsl:call-template name="object.id">
-      <xsl:with-param name="object" select="parent::glossentry"/>
-    </xsl:call-template>
-  </xsl:variable>
-
-  <fo:basic-link internal-destination="{$id}"
-                 xsl:use-attribute-sets="xref.properties">
-    <xsl:apply-templates/>
-  </fo:basic-link>
-
-  <xsl:if test="$insert.xref.page.number != 0">
-    <xsl:apply-templates select="parent::glossentry" mode="page.citation">
-      <xsl:with-param name="id" select="$id"/>
-    </xsl:apply-templates>
-  </xsl:if>
-</xsl:template>
-
 <!-- ==================================================================== -->
 <!-- Glossary collection -->
 
                             or self::subtitle
                             or self::glossentry)]"/>
 
-  <xsl:apply-templates select="title|subtitle"/>
+  <xsl:call-template name="glossdiv.titlepage"/>
+
   <xsl:apply-templates select="$preamble"/>
+
   <fo:list-block provisional-distance-between-starts="{$width}"
                  provisional-label-separation="{$glossterm.separation}"
                  xsl:use-attribute-sets="normal.para.spacing">
                             or self::subtitle
                             or self::glossentry)]"/>
 
-  <xsl:apply-templates select="title|subtitle"/>
+  <xsl:call-template name="glossdiv.titlepage"/>
+
   <xsl:apply-templates select="$preamble"/>
 
   <xsl:for-each select="glossentry">
                             or self::subtitle
                             or self::glossentry)]"/>
 
-  <xsl:apply-templates select="title|subtitle"/>
+  <xsl:call-template name="glossdiv.titlepage"/>
 
   <xsl:apply-templates select="$preamble"/>
 
@@ -533,7 +497,35 @@ GlossEntry ::=
 
     <fo:list-item-label end-indent="label-end()">
       <fo:block>
-        <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
+        <xsl:choose>
+          <xsl:when test="$glossentry.show.acronym = 'primary'">
+            <xsl:choose>
+              <xsl:when test="acronym|abbrev">
+                <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.list"/>
+                <xsl:text> (</xsl:text>
+                <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
+                <xsl:text>)</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+
+          <xsl:when test="$glossentry.show.acronym = 'yes'">
+            <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
+
+            <xsl:if test="acronym|abbrev">
+              <xsl:text> (</xsl:text>
+              <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.list"/>
+              <xsl:text>)</xsl:text>
+            </xsl:if>
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="glossterm" mode="glossary.as.list"/>
+          </xsl:otherwise>
+        </xsl:choose>
         <xsl:apply-templates select="indexterm"/>
       </fo:block>
     </fo:list-item-label>
@@ -546,12 +538,17 @@ GlossEntry ::=
 
 <xsl:template match="glossentry/glossterm" mode="glossary.as.list">
   <xsl:apply-templates/>
+  <xsl:if test="following-sibling::glossterm">, </xsl:if>
 </xsl:template>
 
 <xsl:template match="glossentry/acronym" mode="glossary.as.list">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
 </xsl:template>
 
 <xsl:template match="glossentry/abbrev" mode="glossary.as.list">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
 </xsl:template>
 
 <xsl:template match="glossentry/revhistory" mode="glossary.as.list">
@@ -647,7 +644,7 @@ GlossEntry ::=
                             or self::subtitle
                             or self::glossentry)]"/>
 
-  <xsl:apply-templates select="title|subtitle"/>
+  <xsl:call-template name="glossdiv.titlepage"/>
 
   <xsl:apply-templates select="$preamble"/>
 
@@ -677,7 +674,38 @@ GlossEntry ::=
         </xsl:choose>
       </xsl:with-param>
     </xsl:call-template>
-    <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
+
+    <xsl:choose>
+      <xsl:when test="$glossentry.show.acronym = 'primary'">
+        <xsl:choose>
+          <xsl:when test="acronym|abbrev">
+            <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
+            <xsl:text> (</xsl:text>
+            <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
+            <xsl:text>)</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+
+      <xsl:when test="$glossentry.show.acronym = 'yes'">
+        <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
+
+        <xsl:if test="acronym|abbrev">
+          <xsl:text> (</xsl:text>
+          <xsl:apply-templates select="acronym|abbrev" mode="glossary.as.blocks"/>
+          <xsl:text>)</xsl:text>
+        </xsl:if>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:apply-templates select="glossterm" mode="glossary.as.blocks"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:apply-templates select="indexterm"/>
   </fo:block>
 
   <fo:block margin-left="0.25in">
@@ -686,7 +714,18 @@ GlossEntry ::=
 </xsl:template>
 
 <xsl:template match="glossentry/glossterm" mode="glossary.as.blocks">
-  <fo:inline><xsl:apply-templates/></fo:inline>
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::glossterm">, </xsl:if>
+</xsl:template>
+
+<xsl:template match="glossentry/acronym" mode="glossary.as.blocks">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
+</xsl:template>
+
+<xsl:template match="glossentry/abbrev" mode="glossary.as.blocks">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
 </xsl:template>
 
 <xsl:template match="glossentry/glosssee" mode="glossary.as.blocks">