root/cf-conventions/trunk/xsl/fo/docbook-custom.xsl

Revision 1, 6.4 kB (checked in by halliday1, 3 years ago)

Initial import of CF Conventions document.

Line 
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
3                 version='1.0'>
4
5     <xsl:import href="http://docbook.sourceforge.net/snapshots/xsl/fo/docbook.xsl"/>
6    
7     <!-- Customized titlepage template eliminates blank page between the verso and the TOC -->
8     <xsl:import href="titlepage-templates-custom.xsl"/>
9
10     <!-- Use section numbering for 1 depth level in the document tree -->
11     <xsl:param name="section.autolabel" select="1"></xsl:param>
12     <xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
13    
14     <!-- Causes variablelists to display like html dt, dl -->
15     <xsl:param name="variablelist.as.blocks" select="1"/>
16
17     <!-- This allows tables and other block objects to wrap across multiple pages -->
18     <xsl:attribute-set name="formal.object.properties">
19         <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
20     </xsl:attribute-set>
21
22     <!-- Set left and right margins -->
23     <xsl:param name="page.margin.inner">1.0in</xsl:param>
24     <xsl:param name="page.margin.outer">1.0in</xsl:param>
25
26     <!-- Don't indent the body text, as it wastes paper! -->
27     <xsl:param name="body.start.indent">0pt</xsl:param>
28
29     <!-- Display URLs as footnotes, rather than inline -->
30     <xsl:param name="ulink.footnotes">1</xsl:param>
31    
32     <!-- Add some space above the revision history table -->
33     <xsl:attribute-set name="revhistory.table.properties">
34         <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
35     </xsl:attribute-set>
36    
37     <!-- Custom attribute set to indent revision history table cells -->
38     <xsl:attribute-set name="revhistory.revremark.table.cell.properties">
39         <xsl:attribute name="padding-left">14pt</xsl:attribute>
40         <xsl:attribute name="padding-bottom">8pt</xsl:attribute>
41     </xsl:attribute-set>
42
43     <!-- Make xrefs and links blue -->
44     <xsl:attribute-set name="xref.properties">
45         <xsl:attribute name="color">blue</xsl:attribute>
46     </xsl:attribute-set>
47    
48     <!-- Make revision history header entries bold -->
49     <xsl:attribute-set name="revhistory.table.cell.properties">
50         <xsl:attribute name="font-weight">bold</xsl:attribute>
51         <xsl:attribute name="font-size">14pt</xsl:attribute>
52         <xsl:attribute name="padding-bottom">8pt</xsl:attribute>
53     </xsl:attribute-set>
54    
55     <!-- Custom Revision History template -->
56     <!-- Do not display the "Revision History" title -->
57     <xsl:template match="revhistory" mode="titlepage.mode">
58       <xsl:variable name="explicit.table.width">
59         <xsl:call-template name="dbfo-attribute">
60           <xsl:with-param name="pis"
61                           select="processing-instruction('dbfo')"/>
62           <xsl:with-param name="attribute" select="'table-width'"/>
63         </xsl:call-template>
64       </xsl:variable>
65    
66       <xsl:variable name="table.width">
67         <xsl:choose>
68           <xsl:when test="$explicit.table.width != ''">
69             <xsl:value-of select="$explicit.table.width"/>
70           </xsl:when>
71           <xsl:when test="$default.table.width = ''">
72             <xsl:text>100%</xsl:text>
73           </xsl:when>
74           <xsl:otherwise>
75             <xsl:value-of select="$default.table.width"/>
76           </xsl:otherwise>
77         </xsl:choose>
78       </xsl:variable>
79    
80       <fo:table table-layout="fixed" width="{$table.width}" xsl:use-attribute-sets="revhistory.table.properties">
81         <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
82         <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
83         <fo:table-column column-number="3" column-width="proportional-column-width(1)"/>
84         <fo:table-body start-indent="0pt" end-indent="0pt">
85           <xsl:apply-templates mode="titlepage.mode"/>
86         </fo:table-body>
87       </fo:table>
88     </xsl:template>
89
90    
91    
92     <!-- Customized Revision History / Revision template -->
93     <!-- Reference the attribute set revhistory.revremark.table.cell.properties -->
94     <!-- Copied from xslt/fo/titlepage.xsl -->
95     <xsl:template match="revhistory/revision" mode="titlepage.mode">
96         <xsl:variable name="revnumber" select="revnumber"/>
97         <xsl:variable name="revdate"   select="date"/>
98         <xsl:variable name="revauthor" select="authorinitials|author"/>
99         <xsl:variable name="revremark" select="revremark|revdescription"/>
100         <fo:table-row>
101             <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
102                 <fo:block>
103                     <xsl:if test="$revnumber">
104                         <xsl:call-template name="gentext">
105                             <xsl:with-param name="key" select="'Revision'"/>
106                         </xsl:call-template>
107                         <xsl:call-template name="gentext.space"/>
108                         <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
109                     </xsl:if>
110                 </fo:block>
111             </fo:table-cell>
112             <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
113                 <fo:block>
114                     <xsl:apply-templates select="$revdate[1]" mode="titlepage.mode"/>
115                 </fo:block>
116             </fo:table-cell>
117             <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
118                 <fo:block>
119                     <xsl:for-each select="$revauthor">
120                         <xsl:apply-templates select="." mode="titlepage.mode"/>
121                         <xsl:if test="position() != last()">
122                             <xsl:text>, </xsl:text>
123                         </xsl:if>
124                     </xsl:for-each>
125                 </fo:block>
126             </fo:table-cell>
127         </fo:table-row>
128         <xsl:if test="$revremark">
129             <fo:table-row>
130                 <fo:table-cell number-columns-spanned="3" xsl:use-attribute-sets="revhistory.revremark.table.cell.properties">
131                     <fo:block>
132                         <xsl:apply-templates select="$revremark[1]" mode="titlepage.mode"/>
133                     </fo:block>
134                 </fo:table-cell>
135             </fo:table-row>
136         </xsl:if>
137     </xsl:template>
138
139
140     <!-- Add support for revision history in its own appendix -->
141     <xsl:template match="appendix[@id='revhistory']/para">
142         <xsl:apply-templates select="//revhistory" mode="titlepage.mode"/>
143     </xsl:template>
144
145    
146 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.