print.xsl
branchcda
changeset 0 ff2810600648
child 18 9765d57d1f54
equal deleted inserted replaced
-1:000000000000 0:ff2810600648
       
     1 <?xml version='1.0'?>
       
     2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     3                 version='1.0'
       
     4                 xmlns:fo="http://www.w3.org/1999/XSL/Format">
       
     5 <xsl:import href="/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/fo/docbook.xsl"/>
       
     6 <xsl:import href="titlepage.xsl"/>
       
     7 <xsl:import href="common.xsl"/>
       
     8 
       
     9 <!-- print options -->
       
    10 <xsl:param name="fop.extensions" select="1"/>
       
    11 <xsl:param name="ulink.footnotes" select="1"/>
       
    12 <!-- xsl:param name="double.sided" select="1"/ -->
       
    13 <xsl:param name="hyphenate">false</xsl:param>
       
    14 <!-- xsl:param name="insert.xref.page.number" select="1"/ -->
       
    15 
       
    16 <!-- the following is mainly to sort the glossary -->
       
    17 <xsl:template name="make-glossary">
       
    18   <xsl:param name="divs" select="glossdiv"/>
       
    19   <xsl:param name="entries" select="glossentry"/>
       
    20   <xsl:param name="preamble" select="*[not(self::title
       
    21                                            or self::subtitle
       
    22                                            or self::glossdiv
       
    23                                            or self::glossentry)]"/>
       
    24 
       
    25   <xsl:variable name="presentation">
       
    26     <xsl:call-template name="dbfo-attribute">
       
    27       <xsl:with-param name="pis"
       
    28                       select="processing-instruction('dbfo')"/>
       
    29       <xsl:with-param name="attribute" select="'glossary-presentation'"/>
       
    30     </xsl:call-template>
       
    31   </xsl:variable>
       
    32 
       
    33   <xsl:variable name="term-width">
       
    34     <xsl:call-template name="dbfo-attribute">
       
    35       <xsl:with-param name="pis"
       
    36                       select="processing-instruction('dbfo')"/>
       
    37       <xsl:with-param name="attribute" select="'glossterm-width'"/>
       
    38     </xsl:call-template>
       
    39   </xsl:variable>
       
    40 
       
    41   <xsl:variable name="width">
       
    42     <xsl:choose>
       
    43       <xsl:when test="$term-width = ''">
       
    44         <xsl:value-of select="$glossterm.width"/>
       
    45       </xsl:when>
       
    46       <xsl:otherwise>
       
    47         <xsl:value-of select="$term-width"/>
       
    48       </xsl:otherwise>
       
    49     </xsl:choose>
       
    50   </xsl:variable>
       
    51 
       
    52   <xsl:call-template name="glossary.titlepage"/>
       
    53 
       
    54   <xsl:if test="$preamble">
       
    55     <xsl:apply-templates select="$preamble"/>
       
    56   </xsl:if>
       
    57 
       
    58   <xsl:choose>
       
    59     <xsl:when test="$presentation = 'list'">
       
    60       <xsl:apply-templates select="$divs" mode="glossary.as.list">
       
    61         <xsl:with-param name="width" select="$width"/>
       
    62       </xsl:apply-templates>
       
    63       <xsl:if test="$entries">
       
    64         <fo:list-block provisional-distance-between-starts="{$width}"
       
    65                        provisional-label-separation="{$glossterm.separation}"
       
    66                        xsl:use-attribute-sets="normal.para.spacing">
       
    67           <xsl:apply-templates select="$entries" mode="glossary.as.list"/>
       
    68         </fo:list-block>
       
    69       </xsl:if>
       
    70     </xsl:when>
       
    71     <xsl:when test="$presentation = 'blocks'">
       
    72       <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
       
    73       <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
       
    74     </xsl:when>
       
    75     <xsl:when test="$glossary.as.blocks != 0">
       
    76       <xsl:apply-templates select="$divs" mode="glossary.as.blocks"/>
       
    77       <xsl:apply-templates select="$entries" mode="glossary.as.blocks"/>
       
    78     </xsl:when>
       
    79     <xsl:otherwise>
       
    80       <xsl:apply-templates select="$divs" mode="glossary.as.list">
       
    81         <xsl:with-param name="width" select="$width"/>
       
    82       </xsl:apply-templates>
       
    83       <xsl:if test="$entries">
       
    84         <fo:list-block provisional-distance-between-starts="{$width}"
       
    85                        provisional-label-separation="{$glossterm.separation}"
       
    86                        xsl:use-attribute-sets="normal.para.spacing">
       
    87           <xsl:apply-templates select="$entries" mode="glossary.as.list">
       
    88             <!-- here the sorting -->
       
    89             <xsl:sort select="glossterm"/>
       
    90           </xsl:apply-templates>
       
    91         </fo:list-block>
       
    92       </xsl:if>
       
    93     </xsl:otherwise>
       
    94   </xsl:choose>
       
    95 </xsl:template>
       
    96 
       
    97 </xsl:stylesheet>