print.xsl
branchcda
changeset 0 ff2810600648
child 18 9765d57d1f54
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/print.xsl	Tue Jan 24 13:22:49 2006 -0500
@@ -0,0 +1,97 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version='1.0'
+                xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<xsl:import href="/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/fo/docbook.xsl"/>
+<xsl:import href="titlepage.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<!-- print options -->
+<xsl:param name="fop.extensions" select="1"/>
+<xsl:param name="ulink.footnotes" select="1"/>
+<!-- xsl:param name="double.sided" select="1"/ -->
+<xsl:param name="hyphenate">false</xsl:param>
+<!-- xsl:param name="insert.xref.page.number" select="1"/ -->
+
+<!-- the following is mainly to sort the glossary -->
+<xsl:template name="make-glossary">
+  <xsl:param name="divs" select="glossdiv"/>
+  <xsl:param name="entries" select="glossentry"/>
+  <xsl:param name="preamble" select="*[not(self::title
+                                           or self::subtitle
+                                           or self::glossdiv
+                                           or self::glossentry)]"/>
+
+  <xsl:variable name="presentation">
+    <xsl:call-template name="dbfo-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbfo')"/>
+      <xsl:with-param name="attribute" select="'glossary-presentation'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="term-width">
+    <xsl:call-template name="dbfo-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbfo')"/>
+      <xsl:with-param name="attribute" select="'glossterm-width'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="width">
+    <xsl:choose>
+      <xsl:when test="$term-width = ''">
+        <xsl:value-of select="$glossterm.width"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$term-width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="glossary.titlepage"/>
+
+  <xsl:if test="$preamble">
+    <xsl:apply-templates select="$preamble"/>
+  </xsl:if>
+
+  <xsl:choose>
+    <xsl:when test="$presentation = 'list'">
+      <xsl:apply-templates select="$divs" mode="glossary.as.list">
+        <xsl:with-param name="width" select="$width"/>
+      </xsl:apply-templates>
+      <xsl:if test="$entries">
+        <fo:list-block provisional-distance-between-starts="{$width}"
+                       provisional-label-separation="{$glossterm.separation}"
+                       xsl:use-attribute-sets="normal.para.spacing">
+          <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
+        </fo:list-block>
+      </xsl:if>
+    </xsl:when>
+    <xsl:when test="$presentation = 'blocks'">
+      <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
+      <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
+    </xsl:when>
+    <xsl:when test="$glossary.as.blocks != 0">
+      <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
+      <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="$divs" mode="glossary.as.list">
+        <xsl:with-param name="width" select="$width"/>
+      </xsl:apply-templates>
+      <xsl:if test="$entries">
+        <fo:list-block provisional-distance-between-starts="{$width}"
+                       provisional-label-separation="{$glossterm.separation}"
+                       xsl:use-attribute-sets="normal.para.spacing">
+          <xsl:apply-templates select="$entries" mode="glossary.as.list">
+            <!-- here the sorting -->
+            <xsl:sort select="glossterm"/>
+          </xsl:apply-templates>
+        </fo:list-block>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>